PHP Annotated – October 2024
Welcome to the October edition of PHP Annotated! This recap is carefully handcrafted and brings you the most interesting developments in the PHP community over the past couple of months, so you don’t have to sift through the noise—we’ve done it for you.
Highlights
-
PHP 8.4 RC3 is available for testing
Release managers Calvin Buckley, Saki Takamachi, and Eric Mann have created the
PHP-8.4
branch, development will now be done in the corresponding branch, and the master branch is now targeting the next version of PHP.With the final release expected on November 21, we can look forward to one more release candidate before then.
For a detailed list of what’s coming in PHP 8.4 see php.watch and stitcher.io.
Try PHP 8.4:
- On Mac, you can install it using Homebrew through the Nightly channel via shivammathur/homebrew-php.
- For other platforms, Docker images are probably the easiest way to try it out with no hassle.
- For a quick local test, PHP 8.4 is also available on Herd.
-
PHP 8.1.30, PHP 8.2.24, and PHP 8.3.12 have been released
❗️These are security releases that address several vulnerabilities:
- Parameter injection vulnerability in CGI [GHSA]
- Bypassable
cgi.force_redirect
configuration [GHSA] - Alterable logs in FPM children [GHSA]
- Erroneous parsing of multipart form data [GHSA]
All users should update their installations.
-
PhpStorm 2024.3 Early Access Program Is Now Open
In this early access version, you can already try out full support for PHP 8.4.
-
The PHP Foundation Updates
First, thanks to Ayesh from PHP.Watch, the foundation has relaunched its core roundup series in a new format. Check out the latest PHP Core Roundup #19.
Secondly, The PHP Foundation has joined The Open Source Pledge which aims to encourage companies using open-source software to donate back to projects and help build a sustainable ecosystem. As part of this initiative, three PHP companies even made it onto the Nasdaq billboard.
Thirdly, commissioned by the German government-backed Sovereign Tech Fund, the foundation delivered the Web Services Tool for PHP-FPM.
And last but not least, The PHP Foundation is calling for sponsors. Sponsor the foundation and help shape the future of PHP!
PHP Core
-
📣 RFC: Support Closures in constant expressions
This one has some interesting use-cases:
final class Locale { #[Validator\Custom(static function (string $languageCode): bool { return \preg_match('/^[a-z][a-z]$/', $languageCode); })] public string $languageCode; }
-
📊 RFC: Add persistent curl share handles
Eric Norris proposes to add a new function
curl_share_init_persistent()
, which would allow cURL handles to be stored in global memory and reused in subsequent requests. This enhancement aims to improve performance by reducing the overhead of initializing cURL handles each time.Quoting Matthieu Napoli, the author of Bref, here:
Most PHP apps spend most of their time doing IO (not using the CPU). … But calling APIs (via HTTP) can take a very long time. Very different orders of magnitude.
Why? Because it establishes a TPC and HTTPS connection every time. That can take 100ms or 200ms (HTTPS is bonkers). On *every* request, because PHP (with FPM) recreates a connection every time.
That’s why switching to Laravel Octane or Symfony Runtime makes such a difference sometimes: by keeping the PHP process alive between requests, we can save these 100ms. Comparing that to what we save on the framework boot time, this is massive.
The RFC proposes to share HTTP connections between requests in PHP-FPM: that’s huge because it could bring some of these gains to all PHP apps out there, without having to switch to Octane/Runtime (and the downsides that come with it).
And to further prove the point, here are a couple of real-world use cases and workarounds:
-
📣 RFC: Change behaviour of array sort functions to return a copy of the sorted array
Currently, PHP’s array sort functions take the array to sort by reference, modifying the original array in place. However, these functions always return `true` which often makes them not so convenient to use.
Gina Banyard proposes changing the return value of these functions
sort()
,rsort()
,asort()
,arsort()
,ksort()
,krsort()
,natsort()
,natcasesort()
,usort()
,uasort()
,uksort()
,array_multisort()
,shuffle()
,array_walk()
,array_walk_recursive()
fromtrue
to a copy of the array.This change would allow for a more functional programming style, enabling to chain these functions and work with immutable data more easily.
- ✅ RFC: Change Directory class to behave like an opaque object
- 📣 RFC: Warn on conversions from resource to string
Tools
- Composer 2.8.0
The new version of Composer comes with several interesting additions:--patch-only
flag: This allows you to limit updates to patch-level changes, minimizing the risk of introducing breaking changes.- Ability to explicitly decide if additional arguments/options should be passed to the underlying command.
- imliam/cpx – It’s like `npx` but for PHP. This tool allows you to run any command from any Composer package, even if it’s not installed in your project.
- php.new – A one-line PHP installer from Laravel and Herd teams. It installs a static version of PHP intended specifically for development and testing purposes, along with composer and Laravel. Please note that it’s not suitable for production use.
- Thavarshan/fetch-php – A lightweight package for making HTTP requests inspired by JavaScript’s
fetch
. - API Platform 4 Released – API Platform 4 is now out and officially supports Laravel. It’s a mature framework for building REST and GraphQL API-first applications.
- Pest v3 released – The new version introduces mutation testing, arch presets, and more to streamline your testing workflow.
- Ucar-Solutions/uri-signer – A minimal package for securely signing PSR-15 URIs in PHP applications.
- Nejcc/php-datatypes – Flexible yet strict way of handling primitive data types like integers, floats, and strings in PHP.
- tempestphp/tempest-framework v1.0.0-alpha – Brent tagged the first alpha version of his framework that is designed so developers can write as little framework-related code as possible and focus on app logic.
- cerbero90/json-parser – A zero-dependency lazy parser to read JSON of any size and from any source in a memory-efficient way.
- beyondcode/php-spx – A simple and straightforward PHP profiling extension with a built-in web UI. It’s a fork of a popular profiler with a brand-new UI.
- shipmonk-rnd/dead-code-detector – A PHPStan extension for detecting unused code in your PHP projects.
- shipmonk-rnd/phpstan-baseline-per-identifier – A PHPStan error formatter that generates baseline files for each error identifier.
- pxp-lang/trunk – An all-in-one tool for managing and developing PHP projects. It’s implemented in Rust but installs just like any Composer package.
- staabm/side-effects-detector – Analyzes PHP code for side effects to help maintain clean codebases.
- yiisoft/mailer – A flexible yet simple mailer component.
- phikiphp/phiki – Syntax highlighting powered by TextMate grammars.
- cerbero90/enum – Supercharges enums in your PHP projects.
- mario-deluna/php-glfw – A fully-featured OpenGL and GLFW extension for PHP.
It introduces a whole new set of tools for PHP developers to build graphical applications like games, scientific simulations, and user interfaces.
Check out some examples:
AI
- Generating 1MB of PHP code with AI, a story of MySQL query parser by Adam Zieliński.
- Consuming HTTP Streams in PHP with Symfony HTTP Client and Ollama API by Roberto Butti.
- echolabsdev/prism – A unified interface for working with LLMs in Laravel.
- use-the-fork/synapse – Seamless integration and management of AI agents within Laravel applications. Inspired by Langchain.
Frameworks
- Symfony turned 19 🎂
- New in Symfony 7.2 by Javier Eguiluz.
- All Laravel PHP Attributes at Your Disposal by Christoph Rumpel.
- Laravel Pipelines & Composable Job Middleware by Davey Shafik.
- olivernybroe/collector-intellij – A PhpStorm plugin for Laravel Collections.
Misc
- PHP Object Lazy-Loading is More Than What You Think by Baptiste Leduc.
- PHP 8.4 Property Hooks: Can we get rid of getters/setters now? A benchmark by Benjamin Eberlei.
- How we use hyperfine to measure PHP Engine performance by Benjamin Eberlei.
- Composer: binary-only Docker images by Grzegorz Korba.
- I built an app using a single index.php file, here’s how it went by Andrew Schmelyun.
- To double quote or not, that’s the question! by Florian Engelhardt.
- Building Resilient and Scalable Systems by default by Dariusz Gafka.
- Rediscovering PHP: A Modern Alternative to JavaScript Fatigue by Christopher Watson.
- PHP is the Best Choice for Long‑Term Business by Tomas Votruba.
Conferences
These PHP events are all worth a visit, and some are still accepting presentation proposals:
- Laracon AU – Brisbane, Australia, November 7–8.
- International PHP Conference – Munich, Germany, November 11‒15.
- SymfonyCon 2024 – Vienna, Austria, December 5–6.
- Laracon EU 2025 – Amsterdam, The Netherlands, February 3–4.
- PHP UK Conference 2025 – London, UK, February 19.
- PHP Conference Odawara 2025 – Japan, April 12, 2025. 🆕
- php[tek] 2025 – Chicago, IL, USA, May 20-22. CFP
To find a PHP meetup happening near you, check out the calendar on php.net.
Fun
- Fizz-Buzz in 56 characters?
On the code-golf.io site, you can compete to implement the shortest solutions to simple programming problems. For example, try writing the shortest FizzBuzz code in PHP — currently at just 56 characters!
Well, my naive solution counts 72 chars. Can you do better?
for(;$i++<100;)echo$i%15?($i%3?($i%5?$i:'Buzz'):'Fizz'):'FizzBuzz',"\n";
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/Twitter.