PHP Annotated – June 2023

Greetings everyone!

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!
This is how Rasmus Lerdorf’s initial public announcement of PHP looked.Here’s to many more years of empowering developers and pushing the boundaries of web technology. Happy Birthday, PHP! 🎉🥳🎂

We at the JetBrains PhpStorm team reached out to 20 PHP community members and asked them to pick coding tracks for you. So here is a playlist tailored to make you even more productive while coding PHP:

This playlist, a testament to the vibrant and diverse PHP community, 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.

And Brent has conducted elephpant raffle on the PHP Annotated YouTube channel.

Celebrating 20 Years of WordPress

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
These are security releases, all users are encouraged to update.

❗️Packagist.org maintainer account takeover

PhpStorm 2023.2 Early Access Program Is Open

Is PHP Experiencing a Renaissance?
PHP is making a comeback in trends with its “just works” reputation. The language has evolved, becoming faster, more secure, and enjoyable to use.

Here are the few latest links about it to share with your non-PHP friends:

📺 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 mention it briefly:

📣 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 global nameof() 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. Currently implemented Elasticsearch, Opensearch, Algolia, Meilisearch, RediSearch, Solr, 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 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 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 – Simple framework to build 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 big PHP gigs worth visiting and applying to present at:

Laracon US – Nashville (US), July 19–20, 2023.

CakeFest – Los Angeles (US), Sep 28–3, 2023.

Longhorn PHP – Austin (US), November 2-4, 2023.

SymfonyCon – Brussels (Belgium), December 7–8, 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.

Subscribe to PHP Annotated

Roman Pronskiy

Product marketing manager for @PhpStorm, had a hand in the creation of @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.3.7 released!

PHP 8.2.19 released!

Generated by Feedzy