PHP Digest No. 153 (March 25 - April 8, 2019)
Fresh selection with links to news and materials. In the release: adopted PSR-14 Event Dispatcher, JIT in PHP 8, three RFC sentences from PHP Internals, a portion of useful tools, and much more.
Enjoy reading!
News and Releases
- PHP 7.3.4
- PHP 7.2.17
- PHP 7.1.28
- Packagist.org moves to AWS
- PhpStorm 2019.1 - Debug Twig and Blade templates, search for dead code, improved auto-completion and much more.
- Adopted PSR-14 Event Dispatcher - The new standard governs the work with events in the application. The document defines three interfaces
EventDispatcherInterface
,StoppableEventInterface
andListenerProviderInterface
, and also describes the characteristics that must comply with all the elements and recommendations for implementation. You can read more in a series of posts from one of the members of the working group of the Larry Garfield standard.
It is noteworthy that the new dispatcher in Symfony 4.3 , in fact, is compatible with the standard, but at least because of the use of the typehintaobject
, which is available only in PHP 7.2+, it is not yet possible to use the standard directly in Symfony.
Another example implementation of the yiisoft / event-dispatcher standardlikely to be used in Yii 3.
PHP internals
- [RFC] JIT - The proposal was accepted for PHP 8.0, but the idea of enabling the option in experimental mode in PHP 7.4 did not find support.
The topic is an excellent article by Joe Watkins about what JIT is in general and what its implementation for PHP will give . - [The RFC] the Change the precedence of the concatenation of operator - Currently concatenation operators
.
and math+
,-
have the same priority and are executed from left to right. It is proposed to lower the priority of concatenation:Hidden textecho "sum: " . $a + $b; // текущее поведение echo ("sum: " . $a) + $b; // предлагаемое поведение echo "sum :" . ($a + $b);
- [RFC] Nullable Casting - When casting to a primitive type, it is proposed to make it possible to cast to null, that is, the ability to use it
(?int)$x
besides(int)$x
. - [RFC] Spread Operator in Array Expression - Again, it is proposed to add an operator
...
for arrays. The updated offer removes support for arrays with non-numeric keys.Hidden text$parts = ['apple', 'pear']; $fruits = ['banana', 'orange', ...$parts, 'watermelon']; // ['banana', 'orange', 'apple', 'pear', 'watermelon'];
- Podcast PHP Internals News # 4: Short Arrow Functions with Nikita Popov , # 3: Abolish Narrow Margins and Weak References with Joe Watkins
Instruments
- ivanakimov / hashids.php - A handy library for obfuscating integer identifiers.
- smalot / pdfparser - A library for parsing PDF files and extracting information.
- YOURLS / YOURLS - Link reduction service.
- cyrus-and / fracker - The tool allows you to conveniently track function calls in PHP and will be useful for security researchers.
- wasmerio / php-ext-wasm - An experimental extension that allows you to run WebAssembly binaries directly from PHP, loading them dynamically. In the latest version, the author increased productivity by 29 times and now modules are already running faster than similar ones implemented in PHP.
Symfony
- symfony / mailer - A new component for sending letters.
- Symfony Week # 639 (March 25-31, 2019)
- Symfony Week # 640 (April 1-7, 2019)
Laravel
- thepinecode / blade-filters - Filters for Blade inspired by a similar feature from Twig. Post from the author in support.
- 20 little-known Laravel chips
- Working with null objects in Laravel
- Spatie PHP and Laravel Guidelines
- Automatically detect events and listeners - added in Laravel 5.8.9.
- Telor Laravel Snippet Podcast # 10
- Useful repositories with Eloquent?
Yii
- Preparing Yii for the long run - Now the framework can be officially supported financially. Especially relevant for those who have little time, but want to support.
- Yii development notes # 27
Async php
- WyriHaximusNet / docker-php - Docker images optimized for ReactPHP.
- phpinnacle / ridge - Asynchronous client for AMQP.
- Five Minute PHP # 49 - Asynchronous programming in PHP in 2019.
Learning Materials
- How environment variables actually work in PHP - A must-read article on all the nuances of environment variables following the trail of the Laravel incident .
- How to lock final class using PHPUnit
- Restructuring arrays in PHP
- Output buffer in PHP - You can read more about the topic in Russian here and here .
- Codeception tests for PHP backends
- Yandex.Alice and Telegram bot in PHP with a single functionality
- Own temporary mail: telegram bot
- Modern PHP is beautiful and productive
Entertaining
- ircmaxell / php-c-parser - C language parser implemented in PHP.
- memory-agape / php-java - PHP JVM emulator.
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. 152