PHP Annotated Monthly – December 2018

PHP Annotated Monthly

Hello everyone,

Please welcome the last PHP Annotated Monthly this year with all the news and notable materials from the past month.
Read about PHP 7.3.0, end of life for PHP 5 and PHP 7.0, PHP on AWS Lambda, a bunch of new and accepted RFCs from Internals, Symfony 4.2, WordPress 5.0, Laravel WebSockets, many useful tools, and a lot more!

⚡️ News & Releases

  • PHP 7.3.0 released — Yay! Finally a new major release of PHP Interpreter.
    • Flexible Heredoc and Nowdoc syntax RFC
    json_encode() and json_decode() function will be throwing exception in case of error and flag set RFC
    • Trailing comma in functions calls RFC
    • The new high-resolution monotonic timer function hrtime() PR
    • New functions, array_key_first() and array_key_last() RFC
    • Another new function is_countable() RFC
    • Reference assignment in list() RFC
    • Garbage collector improved PR
    • Regexp engine updated to PCRE2 RFC
    See the full list of changes in the UPGRADING doc and make sure to check the migration guide.
    There are also some benchmark tests showing a ~10% performance boost.
  • The PHP Team also released PHP 5.6.39, PHP 7.0.33, PHP 7.1.25, and PHP 7.2.13. Note that these are the last releases for the 5.6 and 7.0 branches. Also, PHP 7.1 is now security only.
  • PHP on AWS Lambda — Support for custom runtimes on AWS Lambda was announced at the AWS re:Invent 2018 conference. Out of the box, PHP support is available via stackery/php-lambda-layer, but you may build your own layer. This means that instead of doing workarounds and running through Nodejs or Go, we can now write real lambdas on PHP. And remember, PHP was serverless before it was cool:
  • PHP Versions Stats 2018.2 Edition — Traditional half-year stats based on the information that Composer sends to packagist.org. The total share of PHP 7 is 84%.
  • HTTP/3 over QUIC — The next HTTP standard will be using the QUIC protocol, which works over UDP, not TCP. Cloudflare has a good overview of QUIC including problems with NAT and other details.
  • Symfony leaves PHP-FIG — Symfony’s leader Fabien has removed himself and the framework from the list of members of the PHP-FIG. Fabien commented his decision on Twitter:

    In this regard, Anthony Ferrara’s open letter to PHP-FIG from 2014 seems to still be relevant. Back then he said, “Please stop trying to solve generic problems. Solve the 50% problem, not the 99% problem.”
    Two years ago representatives of Laravel, Propel, Doctrine, Guzzle, Stash, and Aura already left the Group, mainly because they were not taking part in the discussions.
    🎥 Checkout the PHP Roundtable Podcast episode about PHP-FIG 3.0.

  • NPM dependency hell: comparison with Symfony, Laravel, and API Platform — Kévin Dunglas shared an analysis of popular PHP frameworks’ dependencies after the JS lib event-stream was compromised.
  • Composer 1.8.0

🐘 PHP Internals

  • [RFC] Password Hashing Registry — The proposal is accepted for the next PHP version and allows registering your own hashing algorithms in extensions.
  • [RFC] Preloading — The proposal is now accepted! It means that in 7.4, we’ll be able to preload any files into opcache. Any functions or classes declared in preloaded files will be available to all subsequent requests as if they were internal elements like strlen() or Exception.

    There is an ongoing discussion about supporting preloading in Composer. Dmitry Stogov also proposed an ability to disable opcache caching per script, using declare(cache=0) at the start of PHP files.
  • [RFC] Spread Operator in Array — The document proposes supporting the ... operator in arrays. For example,
    $parts = ['apple', 'pear'];
    $fruits = ['banana', 'orange', ...$parts, 'watermelon'];
    // ['banana', 'orange', 'apple', 'pear', 'watermelon'];
  • [RFC] FFI – Foreign Function Interface — Dmitry Stogov’s experiment is now official RFC. It allows calling C functions and using C data types from pure PHP. See for example using TensorFlow with FFI.
  • [RFC] Covariant Returns and Contravariant Parameters

🛠 Tools

Symfony

Laravel

Async PHP

CMS

Security

Misc

Thanks for reading!

Your JetBrains PhpStorm Team
The Drive to Develop

image description