PHP Annotated – August 2022

Greetings everyone!

Welcome to the August installment of PHP Annotated, where we’ll 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.

News

PHP 8.2 Beta 3 has been released
The final beta has been delivered according to schedule. The next release is PHP 8.2.0 RC 1, which is expected to be released on September 1.

Check out how to deal with deprecated dynamic properties in PHP 8.2.

For a detailed list of what’s coming in PHP 8.2, see PHP.Watch or stitcher.io.

Also, check out the flash newsletter, The Road to PHP 8.2.

PHP 8.0.22 and PHP 8.1.9 have been released
🪲These are bug-fix releases of currently supported branches.

PHP Foundation Update, July 2022
Check out monthly updates for sponsors.

Composer 2.4 is out
It adds auditing of dependencies for security, bash completions, and many smaller additions. Read more about two new commands: audit and bump.

deployphp/deployer 7.0.0 is out
Deployer is a deployment tool written in PHP with support for popular frameworks out of the box.

One of the biggest changes in v.7 is a new provision recipe. The provision recipe can automatically install and configure any VPS for running your PHP application. It will install webserver, SSL, PHP, Redis, node, and others.

Codeception/Codeception 5.0.0 is out
Attributes, PHP 8 support, sharding, and more features!

swoole/swoole-src 5.0.0 is out
The new version of concurrency extensions comes with an enhanced type system, added types for parameters and return values of all functions, optimized error handling, and other improvements and additions.

PhpStorm 2022.2 released
This major update brings support for Mockery and Rector, enhanced support for generics and enums, improvements to the debugger and HTTP client, and more.

Watch a video overview of 🎬 What’s New in PhpStorm 2022.2.

And we have just published PhpStorm 2022.3 Roadmap.

PHP Core

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

RFC: Asymmetric Visibility #PHP 8.3
Previously, Nikita Popov suggested implementing property accessors a-la C#. That RFC never made it past the discussion phase. Instead, readonly properties were approved.

This time, Ilija Tovilo and Larry Garfield propose adding Swift-like syntax to allow properties to have separate (“asymmetric”) visibility for read and write operations.

class Foo{
public private(set) string $bar,
}

Some notes from Larry:

It would fix the cloneability issue of readonly properties.
It would fix inheritance with readonly. As it stands, readonly is only settable from in the private scope, but not the protected scope.
It would be useful for a property that is rebuilt from other properties. For example, public private(set) $fullName, which is updated internally whenever $o->setFirstName() or $o->setLastName() are called. This could apply to accessor hooks, which are on the roadmap, in the future.

Tools

serversideup/docker-php – Production-ready Docker images for PHP. Optimized for Laravel, WordPress, and more.

Crell/Serde – Robust Serde (serialization/deserialization) library for PHP 8. Read more in Larry Garfield’s introductory post.

statix-php/server – An object-oriented wrapper around PHP’s built-in server.

aimeos/map – PHP arrays and collections made easy. Yet another Laravel-like collections package, but with zero dependencies.

hotmeteor/spectator – OpenAPI testing for PHP.

DaveLiddament/sarb – The tool provides baseline functionality for PHP static analyzers. In v1.5.0 it brings a –clean-up option. This lists five random issues from the baseline to fix for gradually improving code quality.

leafsphp/leaf – A simple yet powerful micro-framework for creating web apps and APIs quickly.

pheature-flags/pheature-flags – A release management system that allows you to activate and deactivate specific features in controlled conditions.

gakowalski/alternative-interpreters – List of alternative PHP interpreters, compilers, and transpilers.

Symfony

symfony/clock is a new component to decouple applications from the system clock.

Its release triggered a short tweet-storm blaming Symfony for framework imperialism:

I have to be honest, seeing @symfony create a clock instead of embracing a community package makes me sad. They keep suffering from the NIH syndrome. It’s literally the same interface as 3(?) clock packages out there. Symfony will probably push them out of polularity.

— Frank de Jonge (@frankdejonge) August 2, 2022

Well, not really:

Without *any* reading about why Symfony is doing this. I would bet good money here is why:

1) It’s trivial.

2) They don’t want to have to bug an outside rando with a day job and 1,000 other concerns to update PHP versions, fix bugs, etc. anytime something comes up.

— taylor otwell 🪐 (@taylorotwell) August 2, 2022

The Package Principles might be worth a read, eg the Stable-Dependencies Principle applies to the discussion at a glance around the new #Symfony Clock component.
See https://t.co/TLAzBbtM4D

— Nicolas Grekas 💙💛 (@nicolasgrekas) August 3, 2022

8 News in Config Transformer that Converts Symfony YML to PHP by Tomas Votruba.

Repository pattern the SOLID way in Symfony by Saeid Raei.

How to apply Hexagonal/Clean/Onion architecture with only two changes to your symfony project by Saeid Raei.

Symfony Testing: using Repository pattern without connecting to database by Saeid Raei.

Voila! Symfony and PHP 8.1 by Mert Simsek.

Decorating Commands by Michael Zangerle.

Clean up your migrations! by Victor Bocharsky.

Laravel

🎬 What’s New In Laravel 9.23.0, Laravel 9.24.0, Laravel 9.25.0 – Check out this new YouTube series by Christof Rumpel where he gives brief overviews of Laravel updates.

protonemedia/laravel-splade – the magic of Inertia.js with the simplicity of Blade.

Sairahcaz/laravel-xhprof – Easy XHProf setup to profile your Laravel application.

BinarCode/laravel-restify – The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

Increase performance by using Eloquent’s setRelation method by Freek Van der Herten.

How I develop applications with Laravel by Steve (King) McDougall.

Scaling Laravel to 100M+ jobs and 30,000 requests/sec by Mateus Guimarães.

How to Safely and Efficiently Upgrade an Out-of-Date Laravel App by Jamison Valenta

Challenges when lift-and-shifting Laravel apps into AWS Lambda by Marco Deleu.

🎬 5-hour Laravel 9 tutorial for beginners.

Misc

Serverless PHP Applications on Digital Ocean Functions by Ayesh Karunaratne.
Narrowing types for static analysis by Jordi Boggiano – A few lessons Jordi has learned in the process of moving a few big old codebases, including Composer, to PHPStan’s level 8.

The PHP Handbook – Learn PHP for Beginners by Flavio Copes.

The difference between Traits, Interfaces, and Abstract Classes in PHP by Andrew Schmelyun.

When to use a trait? by Matthias Noback.

Stop using “static” in PHP and Stop using “extends” in PHP by Mike Zukowsky.

The 100 PHP functions in 2022 by Damien Seguy.

PHP native Attributes quick reference by Damien Seguy – How many core attributes can you name?

Simple Solutions 1 – Active Record versus Data Mapper by Matthias Noback.

3 years of lift-and-shift into AWS Lambda by Marco Aurélio Deleu – Caveats to watch out for when using AWS Lambda as a PHP Hosting provider.

Do generators really reduce the memory usage?

What I would change about PHP by Brent Roose.

Audio/Video

🎬 Why you need to update PHP by Brent Roose.

🎬 PHP 101 for Absolute Beginners – A full 2-hour course.

🎬 Getting Started with TDD in PHP – A free video course by Christoph Rumpel.

Conferences

In-person events are finally back! This fall there will be a few big gigs worth visiting and applying to CFP:

ForumPHP – Disneyland Paris (France), October 13–14.

International PHP Confernece – Munich (Germany), October 24–28.

Longhorn PHP – Austin, TX (US), November 3–5.

SymfonyCon – Disneyland Paris (France), November 17–18.

Community

A nomenclature of hate by Jordi Boggiano.
Maintaining open source projects is hard. And not only because one has to fix things but also deal with frustrated users. Just check some examples gathered by Alexander Makarov: samdark/opensource-hate.

pic.twitter.com/joMQDwaQzP

— swyx 🌴 (@swyx) July 28, 2022

asgrim/side-effect – A framework that does everything in __toString() method [trollface].

And you thought I was joking, I present to you: https://t.co/RqSC4a8i3H

— James Titcumb 🇺🇦 (@asgrim) August 4, 2022

That’s all for today, thanks for reading!

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

Roman Pronskiy

Product marketing manager for @PhpStorm, helped to launch @The PHP Foundation.

Twitter | GitHub

Sergey Panteleev

PHP 8.2 release manager, PHP Documentation maintainer.

Twitter | GitHub

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

Latest News

PHP-Releases

PHP 8.0.23 released!

PHP 8.1.10 released!

PHP 7.4.30 released!