PHP Annotated – May 2024


Welcome to the May edition of PHP Annotated! We’ll recap the most interesting developments in the PHP community over the past couple of months, featuring handpicked news, articles, tools, and videos.

Highlights

PHP 8.2.19, and PHP 8.3.7 released
These are bug fix releases.

Projects IDX
Google announced their new online development environment tool. And it comes with a Laravel template out of the box: https://idx.google.com/new/laravel.

Would be nice to have a vanilla PHP environment and PHP Core environment available too.

Drupal lead Dries Buytaert announces the guiding star for a new version of the Drupal
During his DrupalCon keynote, Dries announced Drupal Starshot.
It is not a brand-new CMS, but more like Drupal with a better user experience.

Drupal Starshot will leverage Drupal Core but have a different governance model to move quickly, allowing for more innovation.

PHP Core

RFC: new MyClass()->method() without parentheses
PHP 8.4 will allow omitting parentheses in chained method calls with new operator:

// OK
$request = (new Request())->withMethod(‚GET‘)->withUri(‚/hello-world‘);

// Also OK
$request = new Request()->withMethod(‚GET‘)->withUri(‚/hello-world‘);

RFC: Support object type in BCMath
PHP 8.4 will have an object API and operator overloading to handle arbitrary precision numbers.

RFC: array_find
PHP 8.4 will also include four new functions to work with arrays: array_find(), array_find_key(), array_any(), and array_all().

📊 RFC: #[Deprecated] Attribute
Benjamin Eberlei and Tim Düsterhus propose adding a new attribute #[Deprecated] with an optional message and since parameters. The latter would indicate a date or a version since which a function or constant is deprecated. The current proposal does not include support for class or property deprecations.

Meanwhile, there is a #[JetBrainsPhpStormDeprecated] attribute with optional reason, replacement, and since parameters, which is supported by PhpStorm and static analyzers.

See other PhpStorm attributes here: JetBrains/phpstorm-attributes.

📣 RFC: New ext-dom features in PHP 8.4
Niels Dossche continues to improve the DOM extension. In this RFC, he proposes adding support for CSS selectors, filling in missing but common features, and adding new properties.

📣 RFC: Transform exit() from a language construct into a standard function
Having exit() as a language construct in PHP brings a few inconsistencies: it cannot be called with a named argument, passed to functions as a callable, does not respect the strict_types declaration, and most confusingly, it does not follow the usual type juggling semantics.
Gina Peter Banyard proposes to make exit() a standard function:

function exit(string|int $status = 0): never {}

scheibling/go-c-shared – Examples for using the Go buildmode c-shared to build modules for other languages. Specifically, it comes with a PHP extension example.

Tools

buggregator/server – A lightweight, standalone server that offers a range of debugging features for PHP applications.

azjezz/assess – Unix filesystem notifications library for PHP. Watch your filesystem for changes without any JS dependencies!

neutomic/neutomic – An asynchronous, lightweight PHP framework tailored for long-running process environments. Built on top of AMPHP, it has a slick API and nice tooling.

phasync/phasync – A micro framework for ultra-high-performance PHP websites with non-blocking IO.

It comes with a CHATBOT.txt file with a prompt to help you integrate the tool into your project. And it also has a phasync/file-streamwrapper to make IO operations in existing projects transparently async. This would affect performance, though, wouldn’t it?

jolicode/automapper – A tool to do automatic object-to-object conversion. The 9.0 release comes with many DX improvements.

NoiseByNorthwest/php-spx – A simple & straight-to-the-point PHP profiling extension with its built-in web UI.

PHP-CS-Fixer – The tool to automatically fix PHP Coding Standards issues now can run in parallelized mode.

TomasVotruba/phpstan-bodyscan – Get error count for each PHPStan level.

TomasVotruba/type-coverage – PHPStan extension to require minimal type-coverage. See “How adding Type Declarations makes Your Code Dangerous” to learn more about it.

ProjektGopher/whisky – A CLI tool for managing and enforcing Git hooks across an entire team.

tomloprod/colority – A lightweight PHP library designed to handle color transformations, validations and manipulations with ease.

Infection PHP – The resent update of the mutation testing framework allows writing your own Custom Mutators.

dshafik/bag – Immutable value objects for PHP.

IonBazan/composer-diff – Compares composer.lock changes and generates a markdown report so you can use it in PR description.

dolthub/dolt – An SQL database that you can fork, clone, branch, merge, push and pull just like a Git repository. Build with Golang but could be handy for dev environments on PHP.

Symfony

New in Symfony 7.1 series by Javier Eguiluz:

TypeInfo Component
WebProfiler Improvements
MapUploadedFile Attribute
Improved Access Token Authenticator
Mapped Route Parameters
POSIX Signals Improvements

How to share your TwigComponent with your team? by Matheo Daninos.

API Platform 3.3 by Antoine Bluchet.

Laravel

ijpatricio/mingle – Use JS components with Vue or React in a Laravel Livewire and/or Filament application.

FrankenPHP Support in Laravel Octane is Out of Beta by Paul Redmond.

Fun with Blade directives by Ryan Chandler.

Encrypting Queued Jobs, Notifications, Mail, and Listeners in Laravel by Ashley Allen.

You don’t need a frontend framework by Andrew Schmelyun.

LaraPackages.com – A handy catalogue of useful Laravel tools.

Other Frameworks

Yii 2.0.50 released – It includes some minor improvements, and the minimum PHP version is raised to 7.3.

PhpStorm

PhpStorm 2024.2 Early Access Program Is Now Open
The upcoming version of PhpStorm will include support for PER Coding Style, a brand-new refactoring floating toolbar, terminal autocompletion for popular PHP tools, and much more.

I’m so excited about this one: @phpstorm will soon have terminal autocompletion for @laravelphp, @symfony, @packagist composer, @phpstan and @psalmphp 😍 pic.twitter.com/4jAhiY886V— Brent (@brendt_gd) May 28, 2024

Misc

All PHP Changed Behaviors grouped by PHP Versions.

Properly restart Opcache after deployment by Benjamin Eberlei.
Check these tools that can help you manage OPcache:
sanderdlm/chop, gordalina/cachetool

Optimizing PHP applications for performance by Mateus Guimarães.

How to Refactor a Method With Optional Params by Luka Peharda.

Primitive Obsession – Why it’s better to use ValueObjects instead of bool, int, string, float, array.

Database Indexing in Theory by Martin Joo.

Tagged Singletons by Brent Roose.

I write my code in the controller by Hakan Aktaş.

What is covariance and contravariance in PHP by Oliver Read.

Iconv, set the charset to RCE: Exploiting the glibc to hack the PHP engine (part 1).

Conferences

These PHP events are all worth a visit, and some are still accepting presentation proposals:

PHPCamp – Pune, India, June 8.
PHPers Summit – Poznań, Poland, June 21.
CakeFest – Luxembourg, July 24–26.
Laracon 2024 – Dallas, TX, USA, August 27–28.
PHP Serbia 2024 – Belgrade, Serbia, September 6-7. CFP 🆕
PHPCon Poland 2024 – Wisła, Poland, October 25–26. CFP 🆕
Laracon AU – Brisbane, Australia, November 7–8.
SymfonyCon 2024 – Vienna, Austria, December 5–6. CFP 🆕

Fun

https://x.com/joshcirre/status/1791514894812221629

If you’re wondering when the next PHP meetup is happening near you, check out the calendar on php.net.

If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or let us know on X (formerly Twitter).

Subscribe to PHP Annotated

Roman Pronskiy

Developer Advocate at @PhpStorm, Operations Manager at @The PHP Foundation.

Twitter | GitHub

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

Read More

Latest News

PHP-Releases

PHP 8.2.24 released!

PHP 8.3.12 released!

Generated by Feedzy