Posts tagged with internals

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]

Thoughts on PHP 8

externals.io

On the PHP internals mailing list Zeev Suraski, a long time core contributor of PHP, started a discussion on what PHP 8 could look like.

As I mentioned a few days ago I intended to send it slightly later - but as Nikita brought up the topic of PHP 8, this is probably as good a time as any to start the discussion. Please note: The goal of this email isn't to discuss in detail each and every topic that's mentioned, but rather to establish whether we want to move to focus on PHP 8 as we go beyond PHP 7.3, based on some of the research projects and PoCs we've been working on.

Read more [externals.io]

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

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

Creating custom stream filters in PHP

In this post we will see how to create a custom stream filter. Streams, first introduced in PHP 4.3, provide an abstration layer for file access. A number of different resources besides files – like network connections, compression protocols etc. can be regarded as “streams” of data which can be serially read and written to.

https://www.codediesel.com/php/creating-custom-stream-filters/

Read more

Diving Laravel

Mohammed Said, Laravel employee number #1, recently announced that he published a new site where he shares stuff he learned while researching the Laravel code base. The site is called "Diving Laravel", which is kinda nice knowing that Mohammed is an incredible diver himself.

In this website I’m going to share notes on the internals of Laravel core, packages, as well as the technologies behind the different components. My goal is to help people understand how things work under the hood and also to be a reminder for me for when I need to look into something that I’ve already studied before.

https://divinglaravel.com/

Read more

How PHP Executes – from Source Code to Render

On the excellent PHP section of Sitepoint Thomas Punt has written a good high ievel overview of how PHP code is executed.

There’s a lot going on under the hood when we execute a piece of PHP code. Broadly speaking, the PHP interpreter goes through four stages when executing code:
  • Lexing
  • Parsing
  • Compilation
  • Interpretation

This article will skim through these stages and show how we can view the output from each stage to really see what is going on. Note that while some of the extensions used should already be a part of your PHP installation (such as tokenizer and OPcache), others will need to be manually installed and enabled (such as php-ast and VLD).

https://www.sitepoint.com/how-php-executes-from-source-code-to-render/

Read more

Inside PHP 7's performance improvements

On the Blackfire.io blog Julien Pauli peeks behind the curtains of PHP. In the five part series he explains how you should write your code to make the best use of the internal optimizations present in PHP 7.

This blog series will show you what changed inside the Zend engine between PHP 5 and PHP 7 and will detail how you, as a developer, may effectively use the new internal optimizations. We are taking PHP 5.6 as a comparison basis. Often, it is just a matter of how things are written and presented to the engine. Performance must be taken care of when critical code is written. By changing some little things, you can make the engine perform much faster, often without losing other aspects such as readability or debugging control.

https://blog.blackfire.io/php-7-performance-improvements-packed-arrays.html

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

Voodoo PHP

If you're interested in some dark magic you should watch this talk by Marco Pivetta on Voodoo PHP. I really like these show-me-the-code type of talks.

We've often seen "magic" code, but how does it even work? Let's explore some arguably bad PHP coding techniques that are actually used in real world libraries to solve problems that would otherwise be a huge burden for all of us.

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