PHP Annotated – June 2023
Welcome to the June edition of PHP Annotated. We’ll recap the most thrilling developments in the PHP community over the past month, featuring handpicked news, articles, tools, and videos.
Highlights
- Happy 28th birthday, PHP!
On June 8, PHP turned 28 years old! For a throwback, see Rasmus Lerdorf’s initial public announcement of PHP.Here’s to many more years of empowering developers and pushing the boundaries of web technology. Happy Birthday, PHP! 🎉🥳🎂
The JetBrains PhpStorm team reached out to 20 members of the PHP community and asked them to name their favorite coding tracks. The result is a playlist tailored to make you even more productive while coding in PHP:
A testament to the vibrant and diverse PHP community, this playlist features contributions from PHP greats such as Christoph Rumpel, Jordi Boggiano, James Titcumb, Matthieu Napoli, Frank de Jonge, Stephen Rees-Carter, Cal Evans, Povilas Korop, Taylor Otwell, Benjamin Eberlei, Nicolas Grekas, Eric Barnes, Ian Landsman, Derick Rethans, Caneco, Zuzana Kunckova, Brent, Tim MacDonald, Mohamed Said, and Paul Redmond.
To commemorate the occasion, Brent also conducted an elephpant raffle on the PHP Annotated YouTube channel.
- Celebrating 20 Years of WordPress
Not 28, but still quite an accomplishment! Congratulations! - PHP 8.3 Alpha 1 available for testing
The first alpha has been released, kicking off the PHP 8.3 release process. Updates will be released every two weeks on a defined schedule with the final release expected around November 23.A feature freeze is expected on July 18, meaning some changes might still make it into the release. The most notable changes at the moment are as follows:
- Readonly amendments
- Anonymous readonly classes
- Arbitrary static variable initializers
- Typed class constants
- New json_validate() function
- Dynamic class constant fetch
- More Appropriate Date/Time Exceptions
See What’s new in PHP 8.3 by Brent to learn more about all the changes.
If you are on Mac, you can try PHP 8.3 with homebrew via the Nightly channel thanks to shivammathur/homebrew-php. Otherwise, Docker images are probably the best option to try it with no hassle.
– “What is the newest PHP version?”
– “What the latest SUPPORTED version?”
– “When is the next version due?”
– “When my specific PHP version will stop being supported?”All answers to these – on this PHP documentation page: https://t.co/VTVmWkwIBZ pic.twitter.com/anp9AUoO7F
— Povilas Korop | Laravel Courses Creator & Youtuber (@PovilasKorop) May 17, 2023
- PHP 8.1.20 and PHP 8.2.7 have been released
❗ All users are strongly encouraged to update to these security releases. - ❗️Packagist.org maintainer account takeover
Find out what happened and whether you might have been affected. - PhpStorm 2023.2 Early Access Program Is Open
Preview the latest features we’ve added to the IDE ahead of the official release – for free. - Is PHP experiencing a renaissance?
PHP is making a comeback with its “just works” reputation. The language has evolved, becoming faster, more secure, and more enjoyable to use.Here are a few links about that to share with your friends who are still skeptical about PHP:
- 📺 PHP is the future by Aaron Francis (mostly about Laravel).
- Go with PHP by Mohamed Said.
- 📺 PHP in 2023 by Brent.
- ChatGPT and PHP
While Frédéric Bouchery demonstrated the ease of generating a PHP RFC draft, using the Promises RFC and Generics RFC as examples, here are some relevant links about the use of LLMs in PHP:- Use Laravel to build a ChatGPT plugin by Benjamin Crozat.
- ChatGPT Plugin with Laravel by Juan Pablo Barreto.
- Saying goodbye to WIP commit messages by Freek Van der Herten.
- AI is a fad and programming is dead by Andrew Schmelyun.
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: 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 { // Override the "read" action with arbitrary logic. get => $this->first . " " . $this->last; // Override the "write" action with arbitrary logic. set($value) => [$this->first, $this->last] = explode(' ', $value); }
- 📣 RFC: Marking overridden methods (#[\Override])
Tim Düsterhus suggests introducing a new#[\Override]
attribute. This attribute, when applied to a method, would prompt the engine to verify the existence of a method with the same name in a parent class or any implemented interfaces.interface I { public function i(): void; } class P { #[\Override] public function i(): void {} // Fatal error: P::i() has #[\Override] attribute, but no matching parent method exists } class C extends P implements I {} // All good 👍
- 📣RFC: NameOf
Robert Landers proposes adding a globalnameof()
function. This function would enable developers to swiftly and easily retrieve the name of virtually any user-defined variable, property, constant, or member.echo nameof($variable); // variable echo nameof($object->property); // property echo nameof(Enum::Case); // Case echo nameof(Object::Const); // Const echo nameof(myFunction(...)); // myFunction echo nameof(MY_CONSTANT); // MY_CONSTANT
Tools
- wp-now – A local dev environment from the WordPress engineering team.
This tool leverages WebAssembly to operate PHP on top of Node.js’ webserver. It’s faster than Docker-based environments and can be used with any PHP apps, although, you’ll have to figure out a way to run your DB. - PHP Monitor 6.0 now available – This major update introduces the new PHP Version Manager, a new Standalone Mode that allows the app to work without having Valet installed, and more.
- pmjones/AutoShel – Automatically maps CLI command names to PHP command classes in a specified namespace, reflecting on a specified main method within that class to determine the argument and option values. The method parameters may be scalar values(int, float, string, bool) or arrays.
- jolicode/castor – A task runner and command launcher designed with a focus on developer experience, built using PHP.
- ProjektGopher/whisky – Simple and framework-agnostic CLI tool for managing and enforcing a PHP project’s git hooks across a team.
- schranz-search/schranz-search – Search abstraction over different search engines written in PHP. The currently implemented engines include Elasticsearch, Opensearch, Algolia, Meilisearch, RediSearch, Solr, and Typesense.
- TestGenAI – A tool by Tomas Votruba, the author of Rector, to generate unit tests for PHP code.
- librarianphp/librarian – A static site generator and markdown indexer inspired by Hugo and DEV, written in PHP. Read the story behind this creation.
Symfony
- Symfony 6.3.0 released
This update introduces various new features and improvements, including a Scheduler component, webhook integration with Mailer and Notifier, an AssetMapper component, enhancements to Dependency Injection, DX improvements, new Notifier integrations, HttpClient improvements, Clock enhancements, and more. See more in the New Symfony 6.3 series. - Say Goodbye to Null-Checking and Exceptions: Using the Maybe Monad in Symfony by Aleksei Kankov.
- We are open-sourcing our jolicode/qotd application – In the blog post Grégoire Pineau talks about using symfony/ux and advanced PostgreSQL with Doctrine in their jolicode/qotd educational application.
- Resolving values for unmapped properties when mapping request data to DTOs in Symfony 6.3+ by Dejan Angelov.
- oroinc/twig-inspector – The tool adds the possibility to find twig templates and blocks used for rendering HTML pages faster during development.
Laravel
- laravel/octane 2.0.0 released with support for Roadrunner v3.
- TomasVotruba/punchcard – This tool substitutes config arrays with fluent typed objects, enabling autocompletion in IDEs and offering other benefits.
- Laravel Package Ocean – A directory of useful Laravel packages.
- WendellAdriel/laravel-exa – Opinionated Modularized API Skeleton for Laravel.
- nasirkhan/laravel-starter – A CMS-like modular starter application project built with Laravel 10.x.
- Laravel Security Middleware by Steve (King) McDougall.
- Top 10 Laravel Audit Security Issues by Stephen Rees-Carter.
- Laravel Queues with Other Languages by Chris Fidao.
- 📺 Laravel Contact App Series by Bert De Swaef.
- 📺 Build A Full Stack TikTok Clone (Nuxt 3, Vue 3, Tailwind CSS, Laravel) – @johnweeksdev has been producing impressive full-length tutorials on building clones of existing apps with Laravel, Vue, and Tailwind. His projects include recreations of TikTok, Instagram, Netflix, Facebook, and more. Credit to Andrew Schmelyun for the recommendation.
Other frameworks
- Yii news 2023, issue 2 by Alexander Makarov.
- leafsphp/leaf 3 – A simple framework for building web apps and APIs quickly.
Misc
- Avoiding empty() in PHP by Andreas Möller.
- Technical Debt is over-used by Larry Garfield.
- Too much magic? by Matthias Noback.
- Mitigating PHP Vulnerabilities with WebAssembly – Jesús González of VMware explains how to run PHP apps in an isolated sandbox using WebAssembly.
- Unleashing the Power of High Performance Queue Services for PHP applications by Pavel Buchnev – On using RoadRunner with PHP apps.
- Diff Speeding | My developer experience – Markus Staab recounts how he significantly improved the speed of sebastian/diff. Numerous tools, including PHPUnit, Psalm, PHP-CS-Fixer, and Codeception, utilize this diffing library and now reap the benefits of these enhancements.
Markus continued his performance investigations in Racing Rector and Doctor Rst Speedup.
- Let’s Write an Esolang in PHP by Ryan Chandler – How to write your own esoteric programming language similar to Brainf*ck in PHP.
- 📺 PHP’s type system dissected? by George Peter Banyard
Conferences
In-person events are in full swing. Check out these upcoming PHP gigs worth visiting and applying to present at:
- Laracon US – Nashville, TN, USA, July 19–20, 2023.
- CakeFest – Los Angeles, CA, USA, Sep 28–Oct 3, 2023.
- Longhorn PHP – Austin, TX, USA, November 2-4, 2023.
- SymfonyCon – Brussels, Belgium, December 7–8, 2023.
If you’re wondering when the next PHP meetup is happening, Tomas Votruba has got you covered with his lovely friendsofphp.org meetup aggregator. There is also a calendar on php.net – Events: June 2023.
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.