PHP Digest No. 151 (February 25 - March 11, 2019)
Fresh selection with links to news and materials. In release: updates of PHP, Laravel 5.8, Xdebug 2.7 and other releases, 3 fresh RFC, 2 accepted, and the concept from PHP Internals, a portion of useful tools, and much more.
Enjoy reading!
News and Releases
- PHP 7.3.3
- PHP 7.2.16
- PHP 7.1.27
- Xdebug 2.7.0 - With the long-awaited full support for PHP 7.3.
- Drupal Camp Belarus 2019 - Minsk, May 18-19. Sent by chilic .
PHP internals
- [RFC] Saner string to number comparisons - In her recent RFC, Nikita Popov suggests changing behavior
==
and making lax comparisons less error prone. In particular, comparison of numbers is proposed to be used only if the string being compared is actually a numeric one. Otherwise, the number is converted to a string, and the string is compared.This proposal entails behavior change comparison operators<=>
,==
,!=
,>
,>=
,<
, and<=
, the constructionswitch
, type of functionsin_array()
,sort()
and others.
In response, ideas of varying degrees of radicalism were received: from the introduction of a special flagdeclare('strict_comparison=1');
that would turn everything==
into===
, to the proposal to cancel == in general .
In the meantime, in 7.4, Warning will probably be thrown if the result of the comparison differs from what is expected in PHP 8. - [RFC] Permit trailing whitespace in numeric strings - Another suggestion designed to improve consistency, but by weakening. It is proposed to allow whitespace at the end of numeric lines, that is, so that
"123 " == " 123"
all other operations work, as well as for lines with leading spaces. - [RFC] Consistent type errors for internal functions - The proposal has been accepted, which means that in PHP 8, built-in functions will throw a TypeError if parameters of the wrong type are passed and, accordingly, will not return null.
- [RFC] Weak References - Proposal for implementing weak links accepted.
- [RFC] Locked Classes - It is proposed to introduce a new keyword
locked
for classes. Such classes will be closed for the dynamic use of properties, that is, you cannot access undeclared properties:Hidden textlocked class TestClass { public $definedProp; } $t = new testClass(); $t->definedProp = "OK"; echo $t->definedProp; unset($t->definedProp); echo $t->nonExistentProp; // Error $t->nonExistentProp = "Not OK"; // Error unset($t->definedProp); // Error
- PHP Internals News: Episode 1 - New podcast from author Xdebug Derick Rethans. In the first issue, a conversation with Nikita Popov.
- Allow throwing from __toString () - PR from Nikita with a fix for one of the old PHP problems - inability to throw exceptions to
__toString
. - List comprehension - A concept from Sarah Goleman with the implementation of list comprehension for PHP. The syntax is less elegant than in Python, but it looks interesting:
$a = [1, 2, 3]; $mul = 3; $c = [ for $a as $v yield $mul * $v use ($mul) ];
Instruments
- spatie / image-optimizer - The package optimizes the size of the image by running through a chain of tools.
- swagger-mock / swagger-mock - Mock server for OpenAPI 3 with support for generating test data. Sent strider2038 .
- johnkary / phpunit-speedtrap - The utility will tell you which of your PHPUnit tests run too long.
- BrainMaestro / composer-git-hooks - Manage Git hooks from composer.json.
- blastcloud / guzzler - Convenient mokas for Guzzle requests.
- ptlis / php-serialized-data-editor - Allows you to manipulate serialized data using PHP without direct deserialization.
- bakame-php / csv-doctrine-collections-bridge - Allows you to make doctrine requests for CSV data. More details in the post .
- VKCOM / noverify - Linter for PHP from the VKontakte Team is now in the public domain. Made based on z7zmey / php-parser . Habrapost in support .
Symfony
- Symfony Gets Real-time Push Capabilities! - Symfony supports push models and real-time applications through the Mercure protocol . The protocol runs on top of SSE and, unlike WebSocket, can use the capabilities of HTTP / 2 and HTTP / 3.
- New in Twig: Classes in Namespaces .
- symfony / http-client - Introduced a new component in the Symfony family - HTTP client. Implemented its own interface without using the PSR-18, but there is an adapter for it. More information on Fabienne slides .
- King2500 / symfony-meta - The package improves auto-completion for Symfony in PhpStorm 2019.1 thanks to the new features of .phpstorm.meta.php .
- Symfony Week # 636 (March 4-10, 2019)
Laravel
- Laravel 5.8 - HasOneThrough relations in Eloquent have been finalized in the release, helpers for strings and arrays are deprecated, email validation has been improved, and more. Read more in a Taylor talk at Laracon Online.
- Taylor Podcast Laravel Snippet # 7 , # 8
- How to replace facades and static calls in Laravel with Dependency Injection
- REST API on Laravel in 100 lines of code
- psalm / laravel-psalm-plugin - Psalm static analyzer plugin for Laravel. It works on the basis of stubs and .phpstorm.meta.php generated using laravel-ide-helper . Post in support.
- AlexHnydiuk / laracent - Centrifugo broadcast driver for Laravel 5.7 Submitted by nokse .
- avto-dev / roadrunner-laravel - RoadRunner integration package with Laravel application. Configs and an easily expandable worker are delivered. Sent paramtamtam .
Yii
- Yii 2.0.16.1
- Release cycle Yii - Major release is supported for 5 years, of which 2 are active fixes and 3 are security error fixes.
- zhuravljov / yii2-queue-monitor - A web interface for monitoring and managing Yii2 queues.
Async php
- WyriHaximus / reactphp-cron - Cron-like scheduler (timer) for ReactPHP.
- phpinnacle / ensign - Asynchronous signal dispatcher on top of Amphp .
Learning Materials
- We predict air pollution using the k-nearest neighbors method in PHP - using php-ai / php-ml .
- PHP binary heap implementation
- Matthias Noback: Hand-written service containers
- How the typo led to the exploitation of the RCE vulnerability
- How I use Live Templates in PhpStorm - The topic of how to fumble snippets for PhpStorm through the GitHub repository.
- Sharing Sessions between Node.js and PHP
- FunPHP: Public frost at the interview
- PHP: changing database structure in team development
- Automate the conversion of word files to other formats
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. 150