PHP Digest No. 152 (March 11 - 25, 2019)

Fresh selection with links to news and materials. In the release: fresh RFC offers and other news from PHP Internals, a portion of useful tools, and many other materials and news!
Enjoy reading!
News and Releases
- PHP Russia 2019 - Moscow, May 17 - The acceptance of applications for reports is coming to an end and there are already several confirmed speakers! First of all, these are the top contributors of the PHP core Nikita Popov and Dmitry Stogov, also the author of spiral / roadrunner Anton Titov, the author of the PHP-ML library for machine learning on PHP Arkadiusz Kondas and others .
- PHP fwdays'19 - Kiev, June 1 - An interesting program is also planned at a conference in Kiev and the creator of Symfony Fabien Potencier has already been announced.
For readers of the PHP Digest, a 15% discount on the promotional code: PHP-digest-fwdays. - Enrico Zimuel joins the Elastic team - After 11 years at Zend, Enrico moves to Elastic, where he will be responsible for the PHP libraries for Elasticsearch. Sent @dmitrybalabka . The fate of other members of the Zend team, who announced their departure from Rogue Wave in October, is also interesting .
PHP internals
- [RFC] New custom object serialization mechanism - Proposal accepted. PHP 7.4 implements a new mechanism for serializing objects and adds two magic methods:Hidden text
// Returns array containing all the necessary state of the object. public function __serialize(): array; // Restores the object state from the given data array. public function __unserialize(array $data): void; - [RFC] JIT - JIT for PHP implements support for Windows and ZTS. The latter means that it can be used in multi-threaded applications. According to the proposal, a vote has already started, judging by the course of which it will probably be adopted for PHP 8.0, but the idea of including it in PHP 7.4 will not get enough support.
The topic also has a post with Redis-server benchmarks in PHP clue / php-redis-server , where the author gained ~ 4-23% on the version with JIT. - [RFC] Arrow Functions 2.0 - The third attempt to implement short lambdas in PHP. This time the syntax is suggested
$y = 1; $fn1 = fn($x) => $x + $y;
At the same time, variables from an external scope are automatically bound by value and no need to use ().
Internals also discusses alternative syntax options:($x) ==> $x + $y;\($x) => $x + $y; - [RFC] Generator comprehensions - The concept is framed in a complete proposal for the implementation of list inclusion (list comprehension). Compared to the concept, as in short lambdas, there is no need to use
use():Hidden text$y = 3; $gen = [for $list as $x if $x % 2 yield $x * $y]; - [RFC] Deprecate curly braces array access - Currently, both square and curly braces can be used to access elements of arrays and strings. And although they are equivalent, curly braces still do not work, for example, to add an element to an array
“$arr{} = 1;”or declare an array“$a={1,2};”. It is suggested that the curly brackets be fixed in this context and that only square brackets be left. Do you use curly braces?
PHP Internals News Episode 2 Podcast: PHP Compiler and FFI - Anthony Ferrara visiting Derick Rethans.- PHP 7.4 release managers announced - They are Peter Kokot and Derick Rethans .
Instruments
- API Platform 2.4 - Under the hood MongoDB, Elasticsearch, Mercure, OpenAPI v3, CQRS, HTTP / 2 Push.
- Roave / no-leaks - Plugin for PHPUnit, which will help to detect memory leaks in the application and tests.
- Roave / Dont - Traits that block the use of certain magic methods.
- bobthecow / psysh - Great interactive mode implementation for PHP. In support of a fresh post on
what is REPL and Exploratory development . - spatie / async - Wrap over PCNTL to easily do parallel tasks. Alternatively there is ackintosh / snidel .
- King2500 / doctrine-phpstorm-meta - The package improves auto-completion for Doctrine in PhpStorm 2019.1 thanks to .phpstorm.meta.php .
- biganfa / php2curl - The library allows you to quickly transform the current context ($ _REQUEST, $ _SERVER, etc.) into the cURL query string. Sent catanfa .
Symfony
Laravel
- spatie / laravel-personal-data-export - The package will help the user to export their personal data as an archive.
- aldemeery / sieve - Simple and elegant filtering for Eloquent models.
- Deploy Laravel in Kubernetes
- About using MySQL views with Eloquent
- Legacy migration of web applications to Laravel

Please stop talking about the Repository template with Eloquent
Yii
- cebe / yii2-openapi - REST API application generator for Yii2 based on the OpenAPI 3.0 specification.

Interview on Hexlet with Alexander Makarov , core developer in the Yii framework
Security
- CSRF Vulnerability in WordPress 5.1 - Analysis and analysis of a vulnerability that leads to remote code execution and is fixed in WordPress 5.1.1 .
- Unique Rule SQL Injection Warning - Laravel SQL injection is possible when using validation
Rule::unique(). - yet another phar deserialization in TCPDF - Vulnerability analysis in the popular tecnickcom / tcpdf package .
Async php
- clue / reactphp-redis v2.3.0 - Asynchronous Redis client based on ReactPHP. The update has improved PubSub support and added lazy connections. More details at the blog post .
- xtrime-ru / TelegramRSS - A Swoole-based tool converts a feed of posts from Telegram to an RSS feed or JSON. In support of habrapost about implementation of
microservices in PHP and Swoole .
Fast web scraping on ReactPHP # 4: Using proxies
CMS
- WordPress finally abandoned PHP 5.2 support and upgraded the minimum version to 5.6 . And by December, they promised to increase the requirements to PHP 7. According to official statistics, versions 5.2-5.5 still use 20% of WP users. Moreover, according to W3Techs, the share of WordPress has grown by 3% for the year and now it is used by 33.4% of the 10 million top Internet sites.
- WordPress 5.2 will add the sodium_compat library and Ed25519 -based update signing system. This will protect the automatic update system.
- JSON support added to Drupal out of the box : API
Learning Materials
- Using Serverless PHP Architecture with PrettyCI and Laravel Queues
How we made PHP 7 twice as fast as PHP 5
Debug Oriented Programming or sadness in the eyes of the Integrator
Monolith for hundreds of client versions: how we write and support tests
Video from Badoo PHP Meetup # 2: About Tests and Code Quality
Report videos from PHP UK 2019
Entertaining
- ircmaxell / php-compiler - The long-abandoned PHP compiler idea from Anthony Ferrara was reincarnated thanks to FFI in PHP 7.4. Theoretically, the compiler is able to generate native machine code and produce a binary executable without a PHP virtual machine. In practice, this is only a concept that supports nothing at all, but the idea is interesting.
Thanks for attention!
If you notice a mistake or inaccuracy - please inform me in PM .
Questions and suggestions write to mail or twitter .
More news and comments on the PHP Digest Telegram Channel .
Send link
Search links for all digests
← Previous release: PHP Digest No. 151