PHP Annotated – January 2024
Welcome to the January edition of PHP Annotated! We’ll recap the most interesting developments in the PHP community over the past month, featuring handpicked news, articles, tools, and videos.
Highlights
- PHP 8.2.15 and PHP 8.3.2 released
🐛 These are bug-fix updates.
- The PHP Foundation Team Update 2024
This year, four additional developers joined the PHP Foundation team to further foster improvements in PHP and its infrastructure: David Carlier, James Titcumb, Saki Takamachi, and Shivam Mathur.
Let’s welcome the new team members and wish them great achievements!
- TIOBE Index for January 2024
Compared to January 2023, JavaScript climbed to 6th, PHP to 7th, and C# remains 5th but leads in growth in TIOBE Software’s popularity ranking of programming languages.
- PhpStorm 2024.1 Early Access Program Is Open
With EAP, you can try upcoming features of PhpStorm and provide your feedback to the PhpStorm team. EAP builds are free to use and do not require a license.
This build brings support for PHPUnit 11, improvements for the Pest test framework, enhancements to code analysis features, and many other improvements.
PHP Core
- 📣 RFC: Opt-in DOM spec-compliance
Proposal to support the “Living Specification” while maintaining backward compatibility, building on the HTML 5 RFC for PHP 8.4.
- 📣 RFC: Deprecate implicitly nullable parameter types
Currently, using
null
as a default value of a function parameter is allowed and does not generate an error even if the parameter has a type declaration and it is not nullable.Moreover, there is a slight inconsistency of allowing optional parameters before required once. For example, the following signature is valid:
function foo(T1 $a, T2 $b = null, T3 $c) {} // Currently valid
Máté Kocsis and Gina P. Banyard to deprecate such declarations and require explicit nullable marks. This is a BC break, but the migration is quite straightforward and can be automated.
function foo(T $var = null) {} // Deprecated warning if RFC accepted function foo(?T $var = null) {} // OK
- ✅ RFC: Improve callbacks in ext/dom and ext/xsl
PHP 8.4 will bring enhanced callable type support in
XSLTProcessor::registerPHPFunctions()
andDOMXPath::registerPhpFunctions()
methods. - ✅ RFC: Resource to object conversion
PHP has a long-term effort to migrate all Resources to Objects. The RFC suggested a plan on how to tackle this transition.
Primary resources (stream, persistent stream), auxiliary resources (contexts, filters, brigades, buckets), and `Process` resource will be converted in PHP 9.0. Others – in PHP 8.4 or another minor version.
- 📊 RFC: Final by default anonymous classes
Daniil Gentili suggests making all anonymous classes final by default and providing a new
open
keyword to make them non-final if needed.
This is similar to Kotlin’snew open class {}
. - 📊 RFC: RFC1867 for non-POST HTTP verbs
Ilija Tovilo proposes adding a new function,request_parse_body()
, to allow handling form data forPUT
andPATCH
requests. - 📊 RFC: Promote the PHP Foundation
This is a non-technical RFC that originated from a PR for php/web-php to promote the PHP Foundation on the php.net website.
- ✅ RFC: Policy Repository
Accepted RFC for maintaining PHP development policies in php/policies repository.
- 📣 RFC: Dedicated StreamBucket class
- 📣 RFC: Multibyte for ucfirst, lcfirst functions, mb_ucfirst mb_lcfirst
- 📣RFC: Raising zero to the power of negative number
Tools
- @php-wasm/cli – PHP running with WASM in your terminal!
npx @php-wasm/cli -r 'echo "hello world";'
Kudos to the WordPress team for moving this forward!
In case you missed it they also have wasm-based local dev environment for PHP wp-now. - nikic/PHP-Parser 5.0.0 – Impressive list of updates in this release.
- owasp-dep-scan/dep-scan – Next-generation security audit tool from OWASP.
Support for PHP applications, packages, and WordPress plugins announced in the recent DepScan ❤️ PHP post.
- ast-grep/ast-grep – CLI tool for code structural search, lint and rewriting. It recently received experimental PHP support. Check the playground.
- spatie/tabular-assertions – Tabular assertions with Pest or PHPUnit.
- denzyldick/phanalist – Fast static analyzer for PHP build with Rust. It’s quite small compared to PHPStan or Psalm, but good to have an option and learn how to Write your own static analyzer for PHP in Rust.
- simonhamp/the-og – Pure PHP OpenGraph image generator.
- valorin/random – Simple helper package for generating cryptographically secure random values.
- theodo-group/LLPhant – PHP Generative AI Framework using OpenAI GPT 4 and inspired by Langchain and LLamaIndex.
- archtechx/enums – Helpers for making PHP enums even better.
- JustSteveKing/php-sdk – Base library for your PHP SDKs.
- danog/php-tokio – Use Rust async libraries in PHP.
- joanhey/AdapterMan – Run almost any PHP app asynchronously with walkor/workerman, without changing your framework or app.
Symfony
- Using Blade template engine from Laravel with Symfony by Abdulbasit Rubeiyya.
- How to ensure that all the routes on my Symfony app have access control by Thomas Hercule.
- Adding feature flags to your Symfony app by Dalibor Karlović.
Laravel
- spatie/laravel-export – Create a static site bundle from a Laravel app.
- tighten/ziggy – Use your Laravel routes in JavaScript.
- defstudio/telegraph – Telegraph is a Laravel package for fluently interacting with Telegram Bots.
- nWidart/laravel-modules – Module management for Laravel.
- Exploring Middleware in Laravel 11 by Grant Holle.
- Laravel Interview Questions by Will Ides.
- Idempotency – what is it, and how can it help our Laravel APIs? by Paul Conroy.
- Run a WordPress blog alongside your Laravel app by Adam Campbell.
Misc
- Building Maintainable PHP Applications: Over-engineering vs under-engineering by Davor Minchorov.
- Starting with Rector PHP: Improving Your PHP Code with Automation by Roberto Butti.
- Creating an Automated Documentation Pipeline in PHP with Autodocs and GitHub Actions by Erika Heidi.
- Performance benchmark of PHP runtimes by Dzmitry Kazbiarovich.
Check comparison of running Symfony 7 with mod_php, PHP-FPM, Nginx Unit, Roadrunner, FrankenPHP, and Swoole.
By the way, according to Web Frameworks Benchmark the fastest way to run PHP is rryqszq4/ngx-php – embedded PHP for nginx.
- Using interfaces in third-party packages by Sven Luijten.
- Testing tips by Kamil Ruczyński.
- Does Xdebug affect performance when turned off? – It does not.
- PHP tips and tricks by Damien Seguy.
- Dreaming of a strong and statically-typed PHP by Ryan Chandler.
Conferences
- Laracon EU – Amsterdam, the Netherlands, Feb 5–6, 2024.
- PHP UK – London, UK, February 15–16, 2024.
- Dutch PHP Conference – Amsterdam, the Netherlands, March 12–15, 2024.
- Laracon India – Udaipur, India, March 23–24, 2024. CFP
- PHP[TEK] 2024 – Chicago, IL, USA, April 23–25, 2024. CFP
- phpday 2024 – Verona, Italy, May 16–17, 2024. CFP
- International PHP Conference – Berlin, Germany, May 27–31, 2024 CFP
- Laravel Live Denmark 2024 – Copenhagen, Denmark, August 22–23, 2024. CFP 🆕
- Laracon 2024 – Dallas, TX, USA, August 27–28, 2024. 🆕
If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send us a tweet.