PHP Annotated – November 2023

Welcome to the November 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 released!

PHP 8.3 is a major update of the PHP language. It contains new features, such as typed class constants, deep-cloning of readonly properties, and additions to the random functionality. As always, it also includes performance improvements, bug fixes and general cleanup.

For a detailed list of what’s new in PHP 8.3, check out the release page, the migration guide, and learn a little more about the release in the PHP Foundation’ announcement.

Install or upgrade to PHP 8.3

Windows: Compiled binaries can be found at windows.php.net. Or you can opt for a community build available on Chocolatey.
Ubuntu/Debian: PHP 8.3 is available on ondrej/php PPA.
Fedora/RHEL/CentOS: Available as a software collection php83 from the Remi repo.
macOS: PHP 8.3 can be installed via Homebrew with shivammathur/homebrew-php tap.
Docker: PHP 8.3 images are now available on Docker Hub with 8.3* tags.

PhpStorm already supports PHP 8.3.

Watch a 📺 Celebrating PHP 8.3 stream with Freek, Brent, and Roman.

⚠️ PHP 8.0 has reached end of life

PHP 8.0.30 marked the last release of PHP 8.0. It will no longer receive official security updates.

PHP 8.1.26 and PHP 8.2.13 have been released

🐛 These are bug fix releases.The PHP 8.1 branch will receive one more release, PHP 8.1.27, which will be the last bug fix release, with only security bug fixes going afterwards.

🎂 PHP Foundation turns 2 years
The PHP Foundation was established two years ago.

Over the past year, the PHP Foundation has supported the work of 6 core developers, and made a significant contribution to the PHP language.

Check out the PHP Foundation’ November 2023 Update.

Consider supporting the PHP Foundation via OpenCollective or GitHub Sponsors.

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: Resource to object conversion
Resource is an obsolete data structure in PHP that has long since been superseded by objects. Work on replacing resources with objects started back in 2013, but most extensions migrated only in PHP 8.0.

Máté Kocsis suggests migrating the remaining extensions and defining a policy for future development.

📣 RFC: Release cycle update
Currently, the lifetime of a PHP version is 3 years. Many people consider this to be short, and the pre-release phase, which is six months, too long.

Jakub Zelenka, the PHP 8.3 release manager, proposes to increase the PHP version lifetime to 4 years (2 years of maintenance and 2 years of security updates) and to revise the pre-release phase.

📣 RFC: Improve callbacks in ext/dom and ext/xsl
Niels Dossche proposes to allow XSLTProcessor::registerPHPFunctions()` and `DOMXPath::registerPhpFunctions()` methods to use `callable.

📣 RFC: Change how JIT is disabled by default
Currently, JIT is running in tracing mode, but disabled by default when opcache.jit_buffer_size is set to 0. RFC suggests disabling JIT by default by setting opcache.jit=disable, and increasing the default jit_buffer_size value to 64m.

📣 RFC: Final anonymous classes

The RFC proposes one of the three options to improve experience with anonymous classes:

1. Add support for final anonymous classes (new final class {} syntax, no breaking changes).
2. OR Make all anonymous classes final by default, without the option to make them final (breaking change)
3. OR Make all anonymous classes final by default, provide an optional `open` keyword to make them non-final (like in Kotlin, new open class {}, breaking changes).

📣 RFC: Property Hooks
In this RFC, Ilija Tovillo and Larry Garfield propose to declare virtual properties with get/set functions.

The design and syntax is most similar to Kotlin, although it also draws influence from C# and Swift.

class User implements Named
{
private bool $isModified = false;

public function __construct(private string $first, private string $last) {}

public string $fullName {
get => $this->first . “ “ . $this->last;

set($value) => [$this->first, $this->last] = explode(‚ ‚, $value);
}
}

Interesting side effect of this RFC is that it allows to declare abstract properties in interfaces:

abstract class A
{
abstract public string $readable { get; }
abstract protected string $writeable { set; }
abstract protected string $both { get; set; }
}

class C extends A
{
public string $readable;
protected string $readable;
protected string $writeable {
set => $field = $value;
}
public string $both;
}

You can already try property hooks on 3v4l.org, thanks to Sjon Hortensius.

And provide you feedback on RFC Vote: Property Hooks.

Tools

php-tui/php-tui – A framework for creating console applications in PHP with pseudo graphical UI.

Crell/Serde – A robust serialization/deserialization library for PHP 8.

pestphp/pest-plugin-stressless – Stress load testing plugin for Pest built on top of grafana/k6. See introductory video 📺 Stressless: Stress Testing for PHP.

buggregator/server – A lightweight, standalone server that offers a range of debugging features for PHP applications, including Xhprof Profiler, Symfony VarDumper Server, SMTP Server, Sentry Compatibility, Monolog Server, and HTTP Requests Dump Server.

It comes with buggregator/trap – console mini-server and helper for more convenient debugging in PHP.

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

reliforp/reli-prof – A sampling profiler or a memory profiler for PHP written in PHP, which reads information about running PHP VM from outside the process. You can find performance bottlenecks or memory leaks of your scripts without changing the target script or loading extensions.

Alternatively, you can try arnaud-lb/php-memory-profiler – A memory profiler extension for PHP. It helps find memory leaks in PHP scripts.

saloonphp/xml-wrangler – A simplistic PHP library designed to make reading and writing XML easy. See also veewee/xml – A package to provide all tools for dealing with XML in PHP without worries

jolicode/JoliMarkdown – A syntax fixer for markdown content. Read Introducing JoliMarkdown for more details.

cerbero90/lazy-json – A framework-agnostic package to load JSON of any dimension and from any source into Laravel lazy collections recursively.

staabm/phpstan-baseline-analysis – Analyzes PHPStan baseline files and creates aggregated error trend-reports.

hirethunk/verbs – An event sourcing package for PHP.

spiral/json-schema-generator – Provides the ability to generate JSON schemas from Data Transfer Object (DTO) classes.

krowinski/php-mysql-replication – Pure PHP Implementation of MySQL replication protocol. This allows you to receive event like insert, update, delete with their data and raw SQL queries.

Symfony

Symfony 7 released
Check out the Living on the edge list to learn about new features in this release. Or check slides Hello Symfony 7 by Alexander M. Turek.

Symfony 6.4 has also been release along with 7.0. Both versions contain the same set of features, except for support for deprecated features.

Also, Symfony 6.4 is a long term support version that gets bug fixes for 3 years and security bugs for another 1 year. Symfony 7.0 is a regular version that will only be supported for 8 months.

Making a Single-Page Application with HTMX and Symfony by Julien Cousin-Alliot.

A retry mechanism for Symfony commands by Smaine Milianni.

phpyh/service-dumper-bundle – Symfony console command to dump dependency injection services.

Laravel

Laravel Pulse announced – The Laravel team revealed an upcoming free and open-source tool. It will be a dashboard with key performance and usage metrics of your app.

Tinkerwell v4 is now released – 📺 Detail Dive.

How does Laravel work? A crystal clear explanation by Benjamin Crozat.

My process for writing Laravel packages by David Carr.
MongoDB Laravel Integration Now Officially Supported — MongoDB has taken over development of the community-driven MongoDB integration for Laravel framework, making it a first-class citizen in their product portfolio.

Unorthodox Eloquent II by Muhammed Sari.

Caching Strategies In Laravel by Jamison Valenta.

laravel/pail – A tool to view Laravel logs in the terminal in a convenient way.

waterholeforum/core – A Laravel-powered community platform / forum.

BookStackApp/BookStack – A platform to create documentation/wiki content built with PHP & Laravel.

stephenjude/filament-feature-flags – Feature flags and segmentation with Laravel Pennant. Check out how to use it.

Other Frameworks

WordPress 6.4 “Shirley” is released

Misc

Best Practices for Using PHP Enumerations by Jeff Ochoa.

Migrating from PER-CS v1.0 (PSR-12) to PER-CS v2.0.

HTTP/3 Request with PHP Curl Extension by Ayesh Karunaratne.

How to use Caddy Server with PHP by Ayesh Karunaratne.

Working with decimals in PHP apps by Mark Scherer.

Type Safety Done Right – PHP Array Hacking by James Seconde.

Phpstan Filter Baseline by Markus Staab – One way to work through a huge PHPStan baseline.

Curated a list of PHP YouTubers.

Autonomous Hacking of PHP Web Applications at the Bytecode Level by Samuel Finixbit.

Bref case study: How Treezor runs a serverless banking platform with Bref – They started with a legacy PHP monolith on servers, put the monolith in Lambda (aka „a bank in a Lambda“), and then transitioned to microservices.

Mastering the (array) Cast Operator in PHP: A Comprehensive Guide by Damien Seguy.

WP-Plugin-Architect – Custom ChatGPT that can write WordPress plugins, with special attention to code security.

Cool #gpt trick I learned from a friend today:

1) create a private GPT
2) upload your #php project in a zip
3) ask it questions on how to improve it

Who knew this goes far beyond the 128k context window 😎

The results are impresive… feels like talking to myself with having… pic.twitter.com/nlOyFlmQ70

— Tomas Votruba (@VotrubaT) November 16, 2023

Fun

Sylius is now offering their ElePHPant through a crowdfunding campaign on Kickstarter.

The Original Pink Elephpant available for sale.

Conferences

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

SymfonyCon – Brussels, Belgium, December 7–8, 2023.
Laracon EU – Amsterdam, The Netherlands, Feb 5–6, 2024.
PHP UK – London, UK, February 15–16, 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

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: December 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

Latest News

PHP-Releases

PHP 8.4.1 released!

PHP 8.1.31 released!

PHP 8.3.14 released!

PHP 8.2.26 released!

Generated by Feedzy