PHP Digest # 198 (25 janvier - 8 février 2021)

Photo: Ivan Gantsev .



Mise à jour des normes PSR-6 et PSR-13, mise en cache de l'héritage dans opkesh, accesseurs de propriété et autres nouvelles de PHP Internals, dialecte Lisp compilé en PHP, ainsi que des outils, vidéos, podcasts et PHP Live Digest .



Bonne lecture!









Nouvelles et communiqués



  • PHP 8.0.2, 7.4.15, 7.3.27

    SoapClient.



    7.3 . PHP 7.2 PHP .
  • PSR-6 PSR-13.

    , .



    , . PHP 8, union static



    return type



    .



    PSR-6: 1.0.0 vs 3.0.0.

    PSR-13: 1.0.0 vs 2.0.0.



  • Developer Ecosystem 2021 — JetBrains

    , PHP . PHP :

  • 12 , 17:00 . PHP, MySQL, , .


PHP Internals



  • [RFC] Warning for implicit float to int conversions

    PHP , . , .



    , (float



    ) (int



    ) .

    function acceptInt(int $i) {
        var_dump($i);
    }
    acceptInt(3.1415);
    
    > int(3)
    
          
          



    3v4l.org/C1bD3



    RFC , float



    .
  • Inheritance Cache

    PR, .



    8% «Hello World» Symfony. , . PHP , . , !

    PHP opcache, «» . // . , .



    «» (, , , , ..) .



    , . , .
  • [RFC] Property Accessors ! !

    , / .



    -, RFC :

    class User {
        public string $name { get; private set; }
    
        //   
        public string $prop { public get; private set; }
    }
    
          
          





    - :

    class Test {
        // Read-write property.
        public $prop { get; set; } //  `public $prop;`
    
        // Read-only property.
        public $prop { get; }
    }
    
          
          





    -, guard



    .

    class User {
        public string $name {
            guard {
                if (strlen($value) === 0) {
                    throw new ValueError("Name must be non-empty");
                }
            }
        }
    }
    
          
          





    -, lazy



    :

    class Test {
        public string $somethingExpensive {
            lazy {
                return computeSomethingExpensive();
            }
        }
    }
    
          
          





    2013 PHP 5.5, .



    , Internals. , , , . , .
  • [RFC] Fibers — . : Swoole:
    Once PHP has a stack coroutine like Fiber, we can do more than what we can do now. Since we can interrupt from PHP internal functions, then we can replace all the implementation of PHP blocking functions, such as sleep(), and we can also replace php_stream so that we can change the implementation of PDO, mysqli, and phpredis into a coroutine way, and we can also make curl become a coroutine version through libcurl's support for multiplexing.

  • [RFC] Enumerations — . №194 -.
  • [RFC] var_representation(): readable alternative to var_export() — , var_export()



    .
  • traverser [RFC] Dump results of expressions in `php -a` — .
  • PHP 8.1 — Brent Roose. - , php.watch.



    RFC PHP RFC Watch





  • vimeo/php-mysql-engine — MySQL- () PHP. Matt Brown, Psalm, , Vimeo .



    : SQLite?



    ( ) , Vimeo , PDO('sqlite::memory:'):





    sqlite:           4.00 MiB  - 66 ms
    php-mysql-engine: 10.00 MiB - 330 ms
    


    , SQLite, .

  • cweagans/composer-patches — Cmposer, . , PR /, .
  • OndraM/ci-detector — CI- .
  • rakibtg/SleekDB — NoSQL PHP. JSON-
  • Orangesoft-Development/throttler — . Guzzle. .
  • sunrise-php/awesome-skeleton — RoadRunner Swoole. fenric.


Symfony





Laravel





Yii









/







  • Phel - Un langage de programmation fonctionnel qui se compile en PHP. C'est un dialecte Lisp et inspiré de Clojure. Exemple de code:
    Texte masqué
    # Define a namespace
    (ns my\example)
    
    # Define a variable with name "my-name" and value "world"
    (def my-name "world")
    
    # Define a function with name "print-name" and one argument "your-name"
    (defn print-name [your-name]
      (print "hello" your-name))
    
    # Call the function
    (print-name my-name)
    
          
          












Le cinquième volet du flux basé sur PHP Digest sera sur la chaîne YouTube PHP Point aujourd'hui . Analyse des actualités et des liens du problème avec des détails et des détails. Nouvel hôte, invité dans le numéro, et traditionnellement une compétition avec des éléphants.

À partir de 20h00 Moscou, Minsk / 19h00 Kiev.






Si vous remarquez une erreur ou une inexactitude, veuillez nous en informer dans un habr personnel ou un télégramme .





Plus de nouvelles et de commentaires sur la chaîne PHP Digest Telegram .



Envoyer le lien

Rechercher des liens dans tous les résumés

Numéro précédent: PHP-Digest № 197




All Articles