From its humble beginnings as a personal project in the mid-90s, PHP has grown to become one of the most popular languages for web development, powering everything from small blogs to large enterprise applications.
It’s a language that has seen an astonishing transformation over the course of almost three decades. Even within the last 10 years, PHP has transformed in ways we couldn’t imagine.
Every year, I write a post about the current state of PHP, where I look back and forward. Let’s begin!
# The PHP Foundation
I usually start these posts with a summary of the latest PHP version, but this time I want focus on the PHP Foundation first. It’s been a little over a year since the foundation was created: a collective of 10 volunteers and 6 developers being paid to work on PHP, the language.
Last year, I wrote this:
I’m a little worried now that Nikita has stepped down. He’s definitely not the only person capable of working on PHP’s core, but he did a tremendous amount of work these past years with PHP 8.0 and 8.1. I hope the PHP Foundation will be up to speed soon and that there are enough core developers who have time to work on PHP next year. PHP 8.2 is already in development, although there aren’t many RFCs drafted yet.
I don’t think 2022 will be the most mind blowing year for PHP, but rather a year of adding stability. Nothing wrong with that.
I think it’s fair to say that the Foundation has delivered. They recently published their 2022 report, and it shows some pretty impressive numbers:
- In total, $580,000 was raised in 2022
- The Foundation pays 6 developers to work on PHP
- Foundation members made almost half of all commits in php-src
- They created 8 new RFCs, only one of those RFCs didn’t make it
I think the Foundation is one of the best things to happen to PHP in a long time, and I hope they’ll be able to improve the language even more in 2023. If you’re working at a company that uses PHP, I’d highly recommend you consider donating.
# PHP 8.2
Moving on to PHP 8.2. It’s generally regarded as a smaller release, but nevertheless it has a bunch of nice features. Just to name a couple:
readonly class PostData
{
public function __construct(
public string $title,
public string $author,
public string $body,
public DateTimeImmutable $createdAt,
public PostState $state,
) {}
}
A brand new randomizer:
$rng = $is_production
? new RandomEngineSecure()
: new RandomEngineMt19937(1234);
$randomizer = new RandomRandomizer($rng);
$randomizer->shuffleString('foobar');
Standalone null
, true
and false
:
function alwaysFalse(): false
{
return false;
}
Disjunctive normal form types:
function generateSlug((HasTitle&HasId)|null $post)
{ }
Redacted parameters:
function connect(
string $user,
#[SensitiveParameter] string $password
) {
}
It’s kind of crazy to realise how much PHP has evolved over the years. I made a little video comparison that clearly shows the difference: