PHP Digest number 148 (January 14 - 28, 2019)
Fresh selection with links to news and materials. In the release: the PEAR repository is hacked, about the future of Xdebug, the PHP Russia 2019 conference, the latest releases, RFC offers from PHP Internals, a portion of useful tools, and much more.
Enjoy reading!
News and Releases
- The PEAR repository has been hacked - pear.php.net has gone offline and is not working yet. It is known that a malicious code was embedded in the file pear.phar. You are at risk if you manually downloaded this file after 12/20/2018. To check you need to download the "clean" file from GitHub and compare the checksums. For automation there is a script . If you used an OS with PHP preinstalled or installed using the package manager, then it is extremely unlikely that you ever used go pear.phar. While the site is down, there are workarounds for installing PEAR packages and building PHP from source .
- The Future of Xdebug - Author Xdebug Derick Rethans talked about technical debt and expansion issues. He leaves MongoDB , where he has been working for the last 7 years. In the near future, I intend to engage in refactoring and finalizing Xdebug, as well as looking for ways of financing. You can support Derik on his Patreon .
- Who pays PHP development? - At the end of the post it is said that the organization igphp.de together with some key members of the PHP team are planning to solve the problem of financing and supporting PHP, and will soon announce it.
- Perforce Swallows Rogue Wave Software
- PhpStorm 2019.1 EAP - The PhpStorm early access program was launched , thanks to which you can be the first to experience new IDE features for free. New features include: debugging Twig templates, the ability to sort imports (use expressions), phpcbf support for fixing style bugs, and many other improvements.
- Onliner PHP Meetup # 3 - Minsk, February 9.
- PHP Russia 2019 - a specialized PHP conference will be held in Moscow on May 17!
How the idea appeared and about the team can be read in the post of Alexander Makarov . In full swing accepted applications for reports. The official @PHPRussiaConfChannel channel and the @PHPRussiaConfTalks chat with discussions are also available in Telegram .
Php internals
- [RFC] Null Coalescing Assignment Operator - The proposal was accepted more than two years ago. And here implementation of the combined operator with check on null is
??=
finally finished and completed. Despite the seeming simplicity of the task, the implementation was very nontrivial .
Total:$a ??= $b
equivalent$a ?? ($a = $b)
. In the case of a$a[foo()] ??= bar()
functionfoo()
will be called exactly once, andbar()
will be called if$a[foo()]
equalnull
(or not set).
In the topic of a good post about other short operators in PHP . - [RFC] New custom object serialization mechanism - Fresh RFC from Nikita Popov. It is proposed to introduce a new mechanism for serializing objects by adding a couple of magic methods:
// Returns array containing all the necessary state of the object.publicfunction__serialize(): array; // Restores the object state from the given data array.publicfunction__unserialize(array $data): void;
This change is intended to fix interface problemsSerialiazable
. Unfortunately, it is impossible to fix the interface itself, but if the proposal is adopted, there will be a working alternative. - [RFC] Code free constructor - It is proposed to add an automatic constructor whose task is to initialize properties:Hidden text
classMotorCycle{ public $vendor; public $cc; public $whells = 2; publicfunction__construct($vendor, $cc){ $this->vendor = $vendor; $this->cc = $cc; } //other methods } classMyCustomMotorCycleextendsMotorCycle{ publicfunction__construct($cc, $whells){ parent::__construct("Custom", $cc); // $this->cc = $cc; this statement will be added within proposed realisation$this->whells = $whells; } }
для кода выше предлагается следующий альтернативный синтаксис:classMotorCycle($vendor, $cc){ public $whells = 2; //other methods }; classMyCustomMotorCycle($cc, $whells) extendsMotorCycle("Custom", $cc){ };
Instruments
- API Platform - A framework based on symfony components for creating an API. The new version supports MongoDB, Elasticsearch, OpenAPI v3 and much more .
- xobotyi / php-mime-type - The library allows you to define known extensions by MIME type and vice versa. Sent by xobotyi .
- PHPStan 0.11 - Static Analyzer for PHP. Announcement release . After a video about the insides of PHPStan from one of the maintenteners.
- Symplify / Statie - A simple static PHP site generator. Quick start .
- leocavalcante / siler - The microframe is implemented on simple functions without using classes. Can be used with Swoole
- directus / directus - Headless CMS with API.
- mgp25 / Instagram-API - The library allows you to use Instagram features hidden in the official API.
- bmitch / churn-php - The tool will help you find candidates for refactoring - the files that have changed the most in Git history and have the greatest cyclomatic complexity.
Symfony
- SymfonyCon 2018 video recordings - Fabien’s report on the local server for women .
- Symfony Week # 629 (January 14-20, 2019)
- Symfony Week # 630 (January 21-27, 2019)
Laravel
- beyondcode / laravel-mailbox - Package for handling incoming email.
- spatie / laravel-eventsauce - Event sourcing for Laravel applications based on EventSauce .
- vanilophp / framework - E-com framework for Laravel.
- Taylor Podcast Laravel Snippet # 2
Async php
- dantleech / fink - A tool for checking a site for broken links. Implemented using amphp / artax .
- reactphp / child-process v0.6.0 - Event library for working with child processes using ReactPHP. Now with Windows support. More in the post .
CMS
- magento / magento-coding-standard - Magento coding standard in the form of rules for PHP_CodeSniffer.
- Recommendations for using Drupal without a frontend (decoupled) in 2019
Study materials
- Tips to speed up code coverage . There is also an experimental krakjoe / pcov extension that allows you to calculate coverage faster than phpdbg.
- Why it is important to polish the code to the smallest detail
- An interesting post about using preprocessor preprocess.io to implement a web application with WebSocket communication.
- My modern working environment for PHP
- A classic post about when to declare classes as final and a fresh addition to it.
- Creating story for Instagram from PHP
- Work begins with testing
- Compare PHP FPM, PHP PPM, Nginx Unit, React PHP and RoadRunner
Entertaining
- Code Galaxies - A fun 3D visualization of the relationships between Composer packages.
Thanks for attention!
If you notice an error or inaccuracy - please inform the PM .
Write questions and suggestions by mail or twitter .
More news and comments on the PHP Digest Telegram channel .
Send link
Search for links on all digests
← Previous release: PHP Digest number 147