PHP Annotated – December 2019

Posted on by Roman Pronskiy

php_annotated

Greetings everyone,

It’s time for our December edition of PHP Annotated! Read about the latest releases PHP 7.4, Symfony 4.4 and 5.0, Xdebug 2.9, news from PHP Internals, articles on Laravel and Symfony, useful tools, videos, podcasts, and a whole lot more!

⚡️ News & Releases

🐘 PHP Internals

  • [RFC] Weak maps – PHP 7.4 has support for weak refs via the special class WeakReference. But in real-world applications, WeakMap is usually what developers would want to have. It is not possible to implement it with the current WeakReference, so this RFC proposes to add one.
            $map = new WeakMap();
            $obj = new stdClass();
            $map[$obj] = 42;
            var_dump($map);
            // object(WeakMap)#1 (1) {
            //   [0]=>
            //     ["key"] => object(stdClass)#2 (0) {}
            //     ["value"] => int(42)
            //   }
            // }
    
            // The object is destroyed here, and the key is automatically removed from the weak map.
            unset($obj);
            var_dump($map);
            // object(WeakMap)#1 (0) {
            // }
        
  • [RFC] Implement new DOM Living Standard APIs in ext/dom – Accepted unanimously.
  • [RFC] Union Types 2.0 – The proposal is accepted for PHP 8.0. The new syntax T1|T2|... can be used anywhere typing is allowed now: parameters, return types, properties.

🛠 Tools

  • Infection 0.15.0 – Update for mutation testing tool in PHP. In this release: Codeception support, PHP 7.4, Symfony 4.4 and 5.0, a couple of new mutators.
  • lisachenko/z-engine – An experimental library that allows accessing and modifying the internal structures of PHP itself, such as zend_class_entry, zval, etc., with the help of FFI. This makes it possible to do some incredible manipulations in runtime, for example, add an interface to an existing class, change the type of the object, or overload an operator.
  • krakjoe/ilimit – The extension provides a method to execute a call while imposing limits on the time and memory that the call may consume.
  • Twig 3.0The new version of the template engine has many small improvements, better performance, and cleaner code.
  • fzaninotto/Faker 1.9 – More than a hundred improvements in the tool for generating test data.
  • cekta/di – A decent PSR-11 implementation.
  • clue/phar-composer – Simple PHAR creation for every PHP project managed via Composer. Introductory post.
  • phplrt/phplrt – A tool for creating parsers in PHP by specified grammar. For example, json5 parser.

Symfony

Laravel

Zend/Laminas

  • Laminas transition update – The Apigility project will be renamed to Laminas API Tools (under Laminas\ApiTools namespace), and Expressive will become Mezzio. The official Laminas release is planned for January 2020.

Yii

🌀 Async PHP

💡 Misc

🎥 Videos

🔈 Podcasts

Give package developers support with symfony/thanks:

Thanks for reading!

If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post, or tweet me.

Subscribe to PHP Annotated

Your JetBrains PhpStorm Team
The Drive to Develop

Subscribe

Subscribe for updates