Join 9,500+ smart developers

Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

What's new in PHP 8.1

stitcher.io - submitted by Brent

PHP 8.1 is currently in active development and will probably be released somewhere around the end of November 2021. We already know some features, changes and deprecations, so let's go through them one by one.

Read more [stitcher.io]

Arrow functions are (probably) coming to PHP 7.4

wiki.php.net

Exciting times in PHP land. Nikita Popov, Levi Morrison and Bob Weinand have officially proposed a concrete implementation for arrow functions.

Anonymous functions in PHP can be quite verbose, even when they only perform a simple operation. Partly this is due to a large amount of syntactic boilerplate, and party due to the need to manually import used variables. This makes code using simple closures hard to read and understand. This RFC proposes a more concise syntax for this pattern. ... Short closures are critically overdue, and at some point we'll have to make a compromise here, rather than shelving the topic for another few years.

Let's hope this one gets accepted!

Read more [wiki.php.net]

Notes on PHP RFCs, and topics that occur repeatedly on PHP internals

github.com

Dan Ackroyd maintains this interesting repo on GitHub with thoughts on why some PHP RFC's are not implemented yet. High on on my wishlist: Briefer closure syntax and Generics

There are some notes on PHP RFCs, why some were declined, and what others might need for them to be implemented. The purpose of these documents is to avoid information from being lost and to try to avoid conversations needing to be repeated multiple times on PHP internals.

Read more [github.com]

Community-driven PHP 8 Wish List

blog.nikolaposa.in.rs

Nikola Poša did some light research on what features PHP developers are craving for to be added in PHP 8. Seems like I'm not the only one that wants arrow functions and generics.

It's been over two months since I started a research on Twitter about the things that developers would like to be added or improved in the next major PHP release. It had a surprisingly long reach, inspiring developers, prominent experts, community representatives to express their opinion through more than a hundred responses.

Read more [blog.nikolaposa.in.rs]

How to compile an unreleased PHP feature

www.sammyk.me

Sammy Kaye Powers, the host of the PHP Roundtable podcast, wrote a blogpost on how to compile PHP from source including unreleased RFC's. After following this tutorial you'll be able to play with the [typed properties] that are currently under discussion.

We'll be discovering and testing a completely unreleased feature of php-src from an RFC that's still under discussion. If you've ever wanted to be ahead of the curve of PHP features or you've just wanted to contribute back to PHP internals, testing an unreleased feature from an RFC is a fun and educational way to do so.

Read more [www.sammyk.me]

What the hell are generics and why would I want them in PHP?

Frederick Vanbrabant, developer at madewithlove and co-organiser of PHP Antwerp, explains on his blog what generics are.

So everyone is talking about this hip “new” kid on the block for PHP: Generics. The rfc is on the table and a lot of people are getting all excited about it, but you don’t fully see the excitement? Let’s explore what it’s all about!

http://frederickvanbrabant.com/2017/05/31/generics-in-php.html

Read more

PHP Generics and why we need them

On the stitcher.io blog a new post appeared that explains the benefits of generics with a practical example. Generics aren't supported in PHP, but there is an RFC.

In today's blog post we'll explore some common problems with arrays in PHP. All the problems and issues listed could be solved with a pending RFC which adds generics to PHP. We won't explore in too much detail what generics are. But at the end of this read you should have a good idea as to why they are useful, and why we really want them in PHP. So without further ado, lets dive into the subject.

https://www.stitcher.io/blog/php-generics-and-why-we-need-them

Read more

Following PHP internals and RFC's

When features get added to PHP there's a lot of discussion first about the new functionality. This is done on the so-called internals mailing list. You can try to follow the discussions via a rather ugly interface at http://news.php.net. The site looks like a very old school web email client where all conversations are just running through each other.

A couple of days ago Matthieu Napoli launched his new site externals.io. This site makes following internals a lot easier. Messages that are part of a conversation are grouped and thus much easier to follow. If you're interested in this you should definitely also check out Made with Love's Why We Can't Have Nice Things project that lists all RFC's and votes.

Read more

Why can't we have nice things: a PHP RFC tracker

Maxime Fabre has created the best RFC tracker out there. I'll probably use his tracker more than then the official pages.

The PHP internals need to be improved, it's not new, I know it, you know it. Between the wiki, the dozens of mailing lists, the Github repository and so on, information is spread out across the web; difficult to access, to comprehend, and to participate in. If you're not familiar with it, it's an unwelcoming world to whomever might want to know more about advances in the PHP language.

This tool aims to simplify this by unifying sources of information under one roof, and answer all the questions people might have about the PHP internals. Who voted on what? Who even are the people voting? What did they also vote on? What comments were made on a particular RFC? And so on.

http://why-cant-we-have-nice-things.mwl.be/

Read more

Why it's so difficult to add scalar type hints to PHP

On the internals mailing list Anthony Ferrara posted a plea for unity on scalar types. If you want to know why it's so difficult to add scalar type hints to PHP, you should read it.

Scalar types are a hard problem. Not technically, but politically, because so many people use PHP in different ways. And everyone thinks their way is "the one true way".
http://news.php.net/php.internals/84689

The RFC needs a 2/3 majority to pass. The yes-camp currently has 67%. Personally I really hope this proposal will get accepted.

Read more

Monitor all proposed changes to PHP

The next major release of PHP, version 7, is going to be an awesome release. Not only will performance be greatly improved, there probably will be lots of nice changes to the language.

The procedure on how PHP gets changed is easily readable and well documented. In short it comes down to this:

  • Proposed changes are submitted on the PHP Wiki.
  • There is a RFC (Request for comments) phase in which key members of the community and contributors can discuss the change.
  • After this round of discussion, which lasts a minimum of two weeks, they can vote if the proposed change gets implemented in a next version of the language.
If you want to closely monitor the future of PHP here's a tool to monitor all activity on the current RFC's.

Read more