PHP Annotated – October 2023

Welcome to the October 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.3.0 RC5 has been released

Another release candidate has been delivered according to schedule. The sixth RC is expected on November 9, and it’ll be the last one before the final release of PHP 8.3.

For a detailed list of what’s coming in PHP 8.3, see php.watch or stitcher.io.

Here are some other resources about the upcoming version that you may want to check out:

New PHP error messages in PHP 8.3 by Damien Seguy. A good way to familiarize yourself with your soon-to-be new PHP version is to read about its error messages.
Readonly clones, #[Override], and json_validate: what’s new in PHP 8.3 by Brent Roose.
Livestream: What’s new in PHP 8.3 by Nuno Maduro.

The PHP 8.1.25 and PHP 8.2.12 bug-fix releases are now available

What was that final noise about after all?
Another minor stir in the PHP community was caused by the release of the stevebauman/unfinalize package. It goes through all library classes in the `vendor` directory and removes the final keyword from all classes and methods.

— Steve Bauman (@ste_bau) September 28, 2023

The motivation for Unfinalize is that some developers want to be able to extend classes from vendor packages. But the maintainers of the packages mark classes as final for good reasons: They want to keep some classes or methods internal and be able to modify them without breaking users’ code.

The topic is not new in the CS world and is known as the fragile base class problem.

In some programming languages, Kotlin, for example, classes are final by default 😱. In others, modifiers are just conventions, but if you don’t respect them, updating your dependencies might break your application.

And this is precisely where the #[Override] attribute from PHP 8.3 will help! If you, for some reason, need to remove final from a class and then extend it, in PHP 8.3, you’ll be able to mark your methods in your child class with #[Override]. In this case, at least, if the base class methods change, you’ll be notified.

Here are some other pieces from the community on the topic:

Final word about unfinalize by Grzegorz Korba.
Final classes in PHP | Java | Any by Jose Maria Valera Reales.
Why does ramsey/uuid use final by Ben Ramsey.
📺 Livestream: Discussing the PHP Unfinalize Drama by Nuno Maduro.

PHP Core

Most of the Core news is covered in detail in the PHP Core Roundup series from the PHP Foundation, so we’ll only make a few brief mentions:

RFC: Increasing the default bcrypt cost

The proposal from Tim Düsterhus to increase the default BCrypt cost has been accepted. In PHP 8.4, the cost will be increased to 12.

Security Tip: Increase Your bcrypt Rounds by Stephen Rees-Carter.

RFC: A new JIT implementation based on IR Framework

The proposal to merge the new JIT implementation was accepted unanimously. PHP 8.4 will have a completely new built-from-scratch JIT.

Dmitry Stogov published a presentation that reveals technical details of the new JIT: (PDF) IR JIT Framework a base for the next generation JIT for PHP.

📣 RFC: Rounding integers as int

Currently round, ceil, and floor functions return float numbers, but when using integers above 2^53, you get unexpected results due to loss of precision.
Marc Bennewitz proposes to perform rounding for integers and to return the resulting integer if possible.

📣 RFC: RFC1867 for non-POST HTTP verbs
Ilija Tovilo proposes adding a new function, request_parse_body(), to expose the existing functionality to userland so that it may be used for other HTTP verbs such as PUT and PATCH.

Tools

dunglas/frankenphp – A modern PHP application server with everything you need: automatic HTTPS, HTTP/3, 103 Early Hints, Zstandard, and worker mode for PHP. It’s built on top of Caddy and offers the simplest configuration process.

utopia-php/framework – A fast and light micro PHP framework that is easy to learn. Maintained by the Appwrite team.

saloonphp/saloon 3.0.0 – A package for building beautiful API integrations and SDKs.

phpro/soap-client 3.0.0 – If you ever need to deal with SOAP, don’t use unmaintained PHP-extensions. Instead, try this general-purpose SOAP client for PHP. It may become your new go-to option.

flow-php/flow – Flow PHP is a strongly typed data processing framework.

benholmen/defrag – This package generates 90’s defragmentation tools style output for your PHPUnit test suite.

flavioheleno/watchr – A command-line utility and GitHub Action that checks for the expiration dates of domain names and TLS certificates.

ad-aures/castopod – An open-source hosting platform built with CodeIgniter and made for podcasters who want to engage and interact with their audiences.

PhpStorm

The Pest Plugin Is Now Maintained by JetBrains.

The PhpStorm 2023.3 Early Access Program Is Now Open.

LLM – This plugin allows you to use any Hugging Face model in PhpStorm.

Voices – This plugin for PhpStorm allows you to leave voice comments in your code 👁️👄👁️.

Symfony

Symfony turns 18 🎂

🎉 Today marks 18 years since the first public commit of the Symfony project (https://t.co/PbX1sp6poL). Big thanks to all contributors, the community, and projects that have embraced Symfony! Your dedication has made a huge impact in the #PHP ecosystem! 🚀 #OpenSource pic.twitter.com/qtp1ujHSER

— Symfony News (@symfony_en) October 18, 2023

New in Symfony 6.4 series by Javier Eguiluz:

Command Profiler
CHIPS Cookies
Subprocess Handler
FQCN-based Routes
Impersonation Utilities
Class-based Serializer Contexts

Combatting Login CSRF with Symfony by Wouter de Jong.
Symfony 7.1 will also introduce a new JSON encoder component.

Symfony/Workflow got a brand new profiler that allows you to browse your workflows and view their graphic representation, among other things.

Laravel

Single-use Tests by Tim MacDonald.

Hacking Laravel Prompts for Fun and Profit by Joe Tannenbaum.

Building a flexible yet abstract external integrations Structure by Ruben Van Assche.

8 Ways Laravel Helps You Write Clean and Terse Code by Benjamin Crozat.

DevOps with Laravel: Getting Started with Kubernetes by Martin Joo.

Laravel without .env files by Marco Deleu.

TomatoPHP – This framework build in Laravel/Splade has tons of plugins and helpers for building your app.

Misc

The Absolute Minimum Every Software Developer Must Know About Unicode in 2023 (Still No Excuses!) by Nikita Prokopov.

How do you get the correct length of a string with emojis?

strlen(‚👨‍👩‍👧‍👦‘); returns 25.
mb_strlen(‚👨‍👩‍👧‍👦‘); returns 7.
grapheme_strlen(‚👨‍👩‍👧‍👦‘); is what you need, and it returns 1.

This post explains why.

Turn Any PHP Script into a Native Single-File Binary by Roman Pronskiy.

How to create a PHP Playground for your documentation by Antoine Bluchet.

PHP by Example – This could be a nice intro for beginners in PHP, inspired by similar ones for Go and Rust.

PHP is Weird, Stateless, and Beautiful by Chris Fidao.

📺 PHP-FPM vs Swoole execution model by Mateus Guimarães.

📺 PHP generics aren’t coming… by Brent Roose.

Fun

📺 PHP is 4x faster than JavaScript! by Nuno Maduro.

php.net/robots.txt has Asimov’s laws of robotics in it 🤖:

jeremeamia/mu – This „real“ 🌚 micro-framework fits in just three lines of code (3-LOC).

(new µ)->get(‚/hello/(?<name>w+)‘, function ($app, $params) {
echo „<p>Hello, {$params[’name‘]}!</p>“;
})
->run();

Conferences

Check out these upcoming PHP gigs worth visiting and applying to present at:

Laracon AU – Sydney, Australia, November 16–17, 2023.
PHPCon Poland – Zawiercie, Poland, November 17–18, 2023.
SymfonyCon – Brussels, Belgium, December 7–8, 2023.
Laracon EU – Amsterdam, The Netherlands, Feb 5–6, 2024. CFP
PHP UK – London, UK, February 15–16, 2024. CFP
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 🆕

If you’re wondering when the next PHP meetup near you is happening, Tomas Votruba has got you covered with his lovely friendsofphp.org meetup aggregator. There is also a calendar on php.net – Events: November 2023.

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 us a tweet.

Subscribe to PHP Annotated

Roman Pronskiy

Developer Advocate at the @PhpStorm team, Operation Manager at @The PHP Foundation.

Twitter | GitHub

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

Read More

Generated by Feedzy