PHP Annotated – December 2019
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 7.4.0 – The long-awaited release of the interpreter is delivered according to schedule. We’d like to say a big thanks to all the contributors and the release managers Derick Rethans and Peter Kokot.
The most notable changes are:
• Typed properties
• Arrow functions
• Limited return type covariance and argument type contravariance
• Null coalescing assignment operator (??)
• Unpack inside array
• Numeric literal separator
• Allow exceptions from __toString()
• OPcache preloading
• FFI – What you need to know about PHP 7.4 FFI
• A bunch of features were deprecated, and there are some backward incompatibilities too.See the full list of changes in the php-src/UPGRADING document.
According to benchmarks, without preloading the performance has been improved by ~11% on average.With the 7.4 release, support for PHP 7.1 is over, and PHP 7.2 will receive one more regular update 7.2.26 on Dec 19. From then there will be only security fixes until Dec 2020. So it’s a good time to upgrade: How To Install PHP 7.4 on different platforms.
- Updating PSR standards – Voting on the interfaces update procedure has ended. A two-stage plan is accepted: all standards will first have v1.1 update with type declaration for parameters, and then, v2.0 with return values type hints. Read more about the reasons and alternative approaches considered.
- WordPress 5.3 – The new update delivers improvements for Gutenberg block editor (by the way it’s available for Laravel too: VanOns/laraberg), a new theme “Twenty Twenty”, and PHP 7.4 compatibility.
- Drupal 8.8.0 – Among other things, it brings native support for Composer.
- PhpStorm 2019.3 – Full PHP 7.4 Support, PSR-12, WSL, MongoDB, and more.
- Xdebug 2.9.0 – This release of Xdebug speeds up code coverage by 250% (as compared to Xdebug 2.7). See the full story.
- PHP versions statistics – 2019.2 – Traditional stats based on the data Composer sends when connecting to packagist.org. New versions are adopted quite fast, PHP 7.3 has 35.24% share, and PHP 5 is slowly but surely declining with 9%.
🐘 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.0 – The 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
- Symfony 4.4 – See the new features in blog posts and the full change list.
- Symfony 5.0 – This includes all the changes from 4.4, in addition to two new components symfony/string and symfony/notifier. Fabien Potencier presents Symfony Notifier.
- A week of Symfony #675 (2 – 8 December 2019).
- Preloading in PHP 7.4 and Symfony 4.4.
Laravel
- Creating a Laravel package tutorial series.
- How to Set Up a Scalable Laravel 6 Application using Managed Databases and Object Storage.
- Laravel Beyond CRUD new chapters: Models with the state pattern, Managing Domains, Entering the application layer, View models.
- On moving the application to Laravel Vapor.
- Form Requests – more than validation.
- Streamlining Laravel.
- Astrocasts – Let’s start building a Command Bus with Laravel and Tactician 2.x!
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
- Yii 2 application optimization
- Yii 2.0.30, extensions, and Yii 3
- PHP 7.4 will be the minimal required version for Yii 3.
- hunwalk/yii2-basic-firestarter – A modified version of the basic template with pre-configured features that can be used to quickly get started on a project.
🌀 Async PHP
- DriftPHP – PHP-framework based on ReactPHP and Symfony components. Demo application.
- clue/reactphp-ami – Async tool for managing Asterisk. Intro post.
- Creating a RESTful API with ReactPHP: Protected Routes
💡 Misc
- How to quickly update PHPUnit from 4 up to PHPUnit 8.
- Serverless PHP FAQ
- Benchmarks of 4 ways to generate UUID in PHP – Comparing PECL extension uuid, the new polyfill symfony/polyfill-uuid, a popular package ramsey/uuid, and libuuid binding via FFI jolicode/ffi-uuid.
- Lessons learned from testing and refactoring legacy.
🎥 Videos
🔈 Podcasts
- 🔈 Laravel Snippet #18: Clear Writing, Great Quality, Low Pain Tolerance – Another episode in the series on how to make money with open source.
- 🔈 PHP Internals News podcast #35 – With Scott Arciszewski about recent vulnerability in PHP-FPM, and cryptography in PHP.
- 🔈 PHP Internals News #37 – PHP 7.4 Celebrations! – Developers talk about their own favorite PHP 7.4 features.
- 5 Ways to Increase PHP Performance + 🔈 The Undercover ElePHPant #2 with Marco “Ocramius” Pivetta.
- 4 Considerations When Running PHP Applications On Multiple Servers + 🔈 The Undercover ElePHPant #3 with Larry Garfield and Robert Douglass.
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.
Your JetBrains PhpStorm Team
The Drive to Develop