PHP Annotated – May 2022

Greetings everyone!

Welcome to the May installment of PHP Annotated, where we catch up on the most interesting things that have happened in the PHP world over the last month,including curated news, articles, tools, and videos.

Kudos to Sergey Pantelev for helping to compile the May edition of PHP Annotated.

News

PHP 8.1.6 and PHP 8.0.19 released
These are non-security bug-fix updates to active branches.
Release managers for PHP 8.2 have been selected!
They are Pierrick Charron and Sergey Panteleev. The PHP 8.1 RM, Ben Remsey, will help the new rookie RMs.

You can check how PHP 8.2 is shaping up on PHP.Watch and in Brent’s What’s new in PHP 8.2 post. The first preliminary PHP 8.2 benchmarks show a 2.5% performance gain over PHP 8.1.

Popular Python and PHP libraries hijacked to steal AWS keys
Learn how the PHPass package was hacked.
PHP-FIG has published a security related errata on PSR-7
You should validate your headers in the MessageInterface implementation.
WordPress 6.0
Brings many usability and UI improvements.
Moodle 4
A major update to a popular open-source e-learning platform.
Developer Ecosystem Survey 2022
Take part in the yearly ecosystem survey for the chance to win a MacBook Pro, Xbox Series X, PlayStation 5, or other prizes.

PHP Core

Most of the Core news are covered in detail in the PHP Core Roundup series from the PHP Foundation. The second episode of the series is coming soon so we’ll only mention it briefly:

🤔 [RFC] Stricter implicit boolean coercions – Under discussion.
🤔 [RFC] Expand deprecation notice scope for partially supported callables – Under discussion.
Listen to the PHP Internals News podcast with Julliette for more details on this particular RFC.
[RFC] Undefined Property Error Promotion – Accepted for PHP 9.0.
[RFC] MySQLi Execute Query – Accepted for PHP 8.2
[RFC] Readonly classes – Accepted for PHP 8.2.

With https://t.co/3hSqel5zEf accepted, having read-only & type-safe simple data structures is going to be very easy in PHP 8.2 pic.twitter.com/4QjimT1AUq

— Giuseppe Mazzapica (@gmazzap) May 11, 2022

The PHP Foundation: Interview with Core Developers – Sebastian Bergman interviews George, Derick, Ilija, Jakub, and Máté. We’ll follow up with Arnaud’s answers soon.
The opcache optimizer – Nikita Popov continues his deep dive series into the PHP core engine.

Tools

azjezz/psl 2.0 – PHP Standard Library – a modern, consistent, centralized, well-typed, non-blocking set of APIs for PHP. This major update includes many improvements and new components, such as Async, TCP, UDP, File, IO, and more.
clue/framework-x – A simple, fast micro framework for building reactive web applications. Runs on top of a ReactPHP async stack:

.@ReactPHP is going to be even more awesome! 🚀

Currently boosting performance from 32000 to 39000 requests/s.

This makes 18 billion requests per month on top 😎 On my laptop! On a single CPU core! 🔥

PHP scales! 💯

— Christian Lück (@another_clue) May 20, 2022

MedUnes/php-spx-installer – An installer for the PHP SPX profiler.
bmitch/churn-php – Discover files in need of refactoring. It examines each PHP file in the path and gives them a score based on cyclomatic complexity and change history.

In PhpStorm, you can enable built-in Refactoring Opportunities inspections that find candidates for refactoring based on several metrics. Learn more here.

Monolog 3.0 – The PHP logger received an update which is mostly a cleanup release, offering stronger types and now requiring at least PHP 8.1.
Tinkerwell 3 – The paid PHP code runner received a major update. Learn more.
Blackfire.io – This versatile tool for locating bottlenecks in PHP code is now free for open source projects.
TomasVotruba/awesome-php-ast – A curated list of tools, articles, and books about abstract syntax trees in the PHP world.
friendsoftwig/twigcs – The missing checkstyle for Twig templates.
PHPStan 1.7.0 – New version that added fully static reflection, implemented @phpstan-consistent-constructor and added a new rule as another way to suppress new static() issues.
Latte 3.0.0 – Update of the popular template engine with a completely rewritten compiler under the hood.
dingo-d/wp-pest-integration-test-setup – A package that adds the WordPress integration test suite with Pest. Read this blog post for more details on how to use it.
CuyZ/Valinor – A PHP library that helps map any input into a strongly-typed value object structure.

Symfony

See what’s coming in Symfony 6.1: Service autowiring via attributes, and improved routing capabilities seem the most hyped in the community. What’s your favorite one so far?
Experimental: Unpacking message properties as handler arguments in Symfony Messenger by Dejan Angelov.
Why do we need Symfony Polyfill (… and why we shouldn’t) by Sebastian Luczak.
nbgrp/singlea – A set of the Symfony bundles that provide true SSO service based on the SingleAuth authentication framework.

Laravel

Does Laravel Scale? by Jack Ellis.
The Fathom Analytics team runs Laravel on infrastructure that can handle over 157 billion requests per month.
The Ultimate Guide to Getting Started With Laravel by Gaurav Makhecha.
A comprehensive and long tutorial to help beginners learn Laravel from scratch.
Eloquent Performance: 4 Examples of N+1 Query Problems by Povilas Korop from Laravel Daily.
How to add a spotlight-like search field to your Laravel app by Freek Van der Herten.
Because nested menus are awful.
Laravel DDD by Steve McDougall.
Getting started with DDD in Laravel.
roelofjan-elsinga/aloia-cms – A drop-in flat-file CMS for Laravel.
The Laravel Idea plugin for PhpStorm collaborated with Christoph Rumpel to bring
a 📺 series of video tutorials.

Misc

Attribute usage in the top-1000 PHP packages by Brent Roose.
Spoiler: only 20% of them use attributes, the most used attribute is #[ReturnTypeWillChange].
📺 Dealing with deprecations by Brent Roose.
Brent discusses how to effectively cope with deprecations, as a bunch are coming in PHP 8.2.

By the way, in PhpStorm, you can instruct a user on how to upgrade
with #[Deprecated(reason: “, replacement: “)] attribute – learn more.

Dockerize a PHP Application with CI/CD by Rafie Younes.
How to profile your PHP applications with Xdebug by Vincent Brouté.
Much ado about null by Larry Garfield.
Why you would really want to use the null type, and what you should be doing instead.
Move that foreach() inside the method by Damien Seguy.

Today I learned you can unpack conditionally in PHP, pretty neat! 👌 pic.twitter.com/cqbDlrCeyr

— Steve Bauman (@SteveTheBauman) May 14, 2022

“I’m declaring an interface because one day I may have multiple implementations”

Sure. So when that day comes, do an Extract Interface refactoring. Most IDEs do it for you in a single click. Until then, drop the interface.

— Hadi Hariri (@hhariri) May 10, 2022

Community

friendsofphp.org – Find an upcoming PHP meetup near you! They are finally back! There’s also Merge PHP, a new-ish PHP Mega Meetup Group, bringing you virtual events.
📺 The PHP Roundtable podcast is Back at the Table in episode 84 with Sara Golemon, Joe Ferguson, Ben Ramsey, and Eric Van Johnson.
Check out these awesome new paper elephants by Vincent Pontier:

If you prefer a classic plush design, here is a nice addition to your herd! Available for order at thelia.net/#Elephant.

That’s all for today – thanks for reading!

Kudos to Sergey Pantelev for helping compile the May edition of the PHP
Annotated.

If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send me a tweet.

Subscribe to PHP Annotated

Your JetBrains PhpStorm team
The Drive to Develop

The PhpStorm Blog : The Lightning-Smart IDE for PHP Programming | The JetBrains Blog
Read More