News

PHP Annotated – May 2024

PHP Annotated Monthly
Welcome to the May edition of PHP Annotated! We’ll recap the most interesting developments in the PHP community over the past couple of months, featuring handpicked news, articles, tools, and videos.

Highlights

PHP Core

  • RFC: new MyClass()->method() without parentheses
    PHP 8.4 will allow omitting parentheses in chained method calls with new operator:

    // OK
    $request = (new Request())->withMethod('GET')->withUri('/hello-world');
    
    // Also OK
    $request = new Request()->withMethod('GET')->withUri('/hello-world');
    
  • RFC: Support object type in BCMath
    PHP 8.4 will have an object API and operator overloading to handle arbitrary precision numbers.
  • RFC: array_find
    PHP 8.4 will also include four new functions to work with arrays: array_find(), array_find_key(), array_any(), and array_all().
  • 📊 RFC: #[\Deprecated] Attribute
    Benjamin Eberlei and Tim Düsterhus propose adding a new attribute #[\Deprecated] with an optional message and since parameters. The latter would indicate a date or a version since which a function or constant is deprecated. The current proposal does not include support for class or property deprecations.

    Meanwhile, there is a #[\JetBrains\PhpStorm\Deprecated] attribute with optional reason, replacement, and since parameters, which is supported by PhpStorm and static analyzers.

    See other PhpStorm attributes here: JetBrains/phpstorm-attributes.

  • 📣 RFC: New ext-dom features in PHP 8.4
    Niels Dossche continues to improve the DOM extension. In this RFC, he proposes adding support for CSS selectors, filling in missing but common features, and adding new properties.
  • 📣 RFC: Transform exit() from a language construct into a standard function
    Having exit() as a language construct in PHP brings a few inconsistencies: it cannot be called with a named argument, passed to functions as a callable, does not respect the strict_types declaration, and most confusingly, it does not follow the usual type juggling semantics.
    Gina Peter Banyard proposes to make exit() a standard function:

    function exit(string|int $status = 0): never {}
    
  • scheibling/go-c-shared – Examples for using the Go buildmode c-shared to build modules for other languages. Specifically, it comes with a PHP extension example.

Tools

  • buggregator/server – A lightweight, standalone server that offers a range of debugging features for PHP applications.
  • azjezz/assess – Unix filesystem notifications library for PHP. Watch your filesystem for changes without any JS dependencies!
  • neutomic/neutomic – An asynchronous, lightweight PHP framework tailored for long-running process environments. Built on top of AMPHP, it has a slick API and nice tooling.
  • phasync/phasync – A micro framework for ultra-high-performance PHP websites with non-blocking IO.

    It comes with a CHATBOT.txt file with a prompt to help you integrate the tool into your project. And it also has a phasync/file-streamwrapper to make IO operations in existing projects transparently async. This would affect performance, though, wouldn’t it?

  • jolicode/automapper – A tool to do automatic object-to-object conversion. The 9.0 release comes with many DX improvements.
  • NoiseByNorthwest/php-spx – A simple & straight-to-the-point PHP profiling extension with its built-in web UI.
  • PHP-CS-Fixer – The tool to automatically fix PHP Coding Standards issues now can run in parallelized mode.
  • TomasVotruba/phpstan-bodyscan – Get error count for each PHPStan level.
  • TomasVotruba/type-coverage – PHPStan extension to require minimal type-coverage. See “How adding Type Declarations makes Your Code Dangerous” to learn more about it.
  • ProjektGopher/whisky – A CLI tool for managing and enforcing Git hooks across an entire team.
  • tomloprod/colority – A lightweight PHP library designed to handle color transformations, validations and manipulations with ease.
  • Infection PHP – The resent update of the mutation testing framework allows writing your own Custom Mutators.
  • dshafik/bag – Immutable value objects for PHP.
  • IonBazan/composer-diff – Compares composer.lock changes and generates a markdown report so you can use it in PR description.
  • dolthub/dolt – An SQL database that you can fork, clone, branch, merge, push and pull just like a Git repository. Build with Golang but could be handy for dev environments on PHP.

Symfony

Laravel

Other Frameworks

  • Yii 2.0.50 released – It includes some minor improvements, and the minimum PHP version is raised to 7.3.

PhpStorm

Misc

Conferences

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

Fun

If you’re wondering when the next PHP meetup is happening near you, check out the calendar on php.net.


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 (formerly Twitter).

Subscribe to PHP Annotated

Roman Pronskiy

Developer Advocate at @PhpStorm, Operations Manager at @The PHP Foundation.

Twitter | GitHub

image description