PHP Annotated – May 2025

PHP Annotated

Welcome to the May edition of PHP Annotated!

It’s been a minute since the last edition. Turns out time flies when you’re deep in foundation work, and the occasional existential debugging session. But we are back.

Here’s everything you might’ve missed in the PHP world, we dug through the noise so you can just enjoy the highlights.

Highlights

PHP Core

  • RFC: Pipe operator v3

    The first proposal to bring a pipe operator to PHP dates back to 2016, followed by a second attempt in 2020. Now, on the third try it’s finally happening!

    Starting with PHP 8.5, you’ll be able to use the |> operator to chain function calls in a clean, readable way:

    $result = "Hello World"
                |> htmlentities(...)
                |> str_split(...)
                |> fn($x) => array_map(strtoupper(...), $x)
                |> fn($x) => array_filter($x, fn($v) => $v != 'O');
    

    Kudos to Larry Garfield for the persistence and effort to see this through!

    Check out Brent’s video overview of PHP 8.5’s pipe operator.

  • RFC: array_first() and array_last()

    PHP 7.3 introduced array_key_first() and array_key_last() to get the first and last keys of an array, but still no functions to get the first and last values of an array.

    Thanks to Niels Dossche two new functions will be added in PHP 8.5:

    array_first([1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd']); // 'a'  
    array_last([1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd']); // 'd'  
    
  • RFC: Marking return values as important (#[\NoDiscard])

    PHP 8.5 will come with a new #[\NoDiscard] attribute to indicate that the return value of a function or method is “important” and that not doing anything with the return value is likely to be a bug.

    #[\NoDiscard("this is important")]
    function foo(): int {
        return 0;
    }
    
    $results = foo(); // No warning, because the return value is consumed by the assignment
    
    foo();// Warning: The return value of function foo() is expected to be consumed
    
  • ? RFC: True Async

    Edmond Dantes proposes to create a standard for writing concurrent code in PHP, as well as a C-API interface that will allow PHP to be extended at a low level with C, Rust, C++, and other languages. This will allow modules to support non-blocking I/O operations without having to override PHP functions or duplicate code.

    As Edmond clarified on the mailing list, the plan is to simplify the current RFC as much as possible to make it easier to pass. New syntax should be discussed closer to future versions of PHP (likely 9.0).

    You can follow the development process almost live in this separate github.com/true-async.

  • PHP 8.5 release managers announced

    As is tradition, PHP 8.5 will have 2 rookie release managers: Volker Dusch and Daniel Scherzer. They will be assisted by veteran RM Pierrick Charron.

  • There are a few other RFCs with mentioning that passed, are under discussion, or were declined already:

Tools

  • PHP WebRTC

    A full implementation of the WebRTC protocol in pure PHP! No Node.js or JavaScript is required on the backend to use. You would need FFI enabled, however.

    The goal is to make it easy to build WebRTC-based apps in pure PHP – including media servers, video conference web app, SFUs, and peer-to-peer apps.

    Bravo! ?

  • phpacker/phpacker

    Package any PHP script or PHAR into a standalone, cross-platform executable.

    I briefly explained how this works in my blogpost Turn Any PHP Script into a Native Single-File Binary. Phacker makes it really easy and builds for Mac, Linux, and Windows!

  • NativePHP 1.0

    The tool allows building desktop application with PHP and JavaScript/HTML/CSS.

    There is also a paid version for iOS and Android devices: NativePHP for Mobile.

  • boson-php/boson

    This is another tool to build cross-platform desktop apps with PHP, JavaScript, HTML, and CSS. But instead of Electron, under the hood, it uses saucer/saucer, a modern, cross-platform C++ webview library, which allows making apps really slim:

    $app = new Boson\Application();
    
    $app->webview->html = <<<'HTML'
        <button onclick="foo('HELLO');">Hello</button>
        HTML;
    
    $app->webview->bind('foo', var_dump(...));
    $app->run();
  • NPX-like package execution tools for PHP

    There are a few such tools available out there:

    • imliam/cpx – Run any command from any composer package, even if it’s not installed in your project.

    • eduardocruz/phpx – PHPX is a NPX-like package execution tool for PHP.

    I also vibe-coded prototyped my own tool in Python. The difference is that it does not require users to have PHP or Composer on their machine: pronskiy/pocus.

    Originally I wanted my friends who have uvx installed to be able to use my MCP servers with no additional prerequisites. So it allows them to run any script from GitHub with one command:

    uvx pocus https://github.com/pronskiy/mcp examples/echo.php

    Or any command from an existing PHP package:

    uvx pocus phpstan/phpstan phpstan analyse ./src
  • masan4444/phpup – Cross-Platform PHP version manager written in Rust. Seems abandoned, but maybe someone wants to pick it up?
  • php-internal/dload – Helps to download binaries from release assets.
  • utopia-php/vcs – Lite & fast micro PHP vcs abstraction library that is easy to use.
  • jerowork/graphql-attribute-schema – Easily build your GraphQL schema using PHP attributes instead of large configuration arrays.
  • mario-deluna/php-glfw – A fully-featured OpenGL and GLFW extension for PHP.

    At first I thought it was another fun project to make cool demos like these:

    medilies/php-pong – Classic Pong game programmed with pure OpenGL wrapped in OOP code.
    ping-pong

    mario-deluna/php-chip8 – Yet another CHIP-8 emulator, but in PHP!.

    Or even like this:
    phpgl/php-craft – Mining PHPotentials: A Minecraft-Inspired Game written in PHP.

    But it actually has useful applications, for example: creating animated code snippets with Tempest Highlight & PHP-GLFW:

AI

The ecosystem of AI tooling for PHP is growing fast! Here are just a few interesting findings.

MCP

If you’re new to the topic, check out my short intro video: MCP – What is that?

I found the interface of logiscapedev/mcp-sdk-php a bit frustrating to work with, so I built a simple wrapper to make things easier:

  • pronskiy/mcp – ? The fast, PHP way to build MCP servers.

    Here’s what a minimal MCP server looks like using the wrapper:

    new \Pronskiy\Mcp\Server(name: 'echo-server')  
    ->tool(  
        name: 'echo' ,  
        description 'Echoes text',  
        fn (string $text) => $text
    )->run();  
    

But there is a much more powerful alternative:

  • php-mcp/server – PHP implementation for the Model Context Protocol (MCP) server.
    mcp server

LLM Frameworks

  • LLPhant/LLPhant – A lightweight and intuitive framework with tons of ready-to-use tools. Well-documented, actively developed.
  • inspector-apm/neuron-ai – Open source framework to create full featured AI Agents in PHP.

Using AI models in PHP

Thanks to an open ONNX format, it is possible to run many AI models in PHP natively. These are the tools that facilitate it:

PhpStorm

Frameworks

Misc

Conferences

These PHP events are all worth a visit, and some are still accepting presentation proposals:

To find a PHP meetup happening near you, check out the calendar on php.net.

Fun


If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or let us know on X/Twitter: @pronskiy.

Subscribe to PHP Annotated


If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or let us know on X/Twitter.

Subscribe to PHP Annotated

Roman Pronskiy

Developer Advocate at @PhpStorm, Executive Director at @The PHP Foundation.

Twitter | GitHub

image description