PHP Annotated — January 2022
Catch up on the latest from the PHP world with our specially curated news, articles, tools, and videos.
- The PHP Foundation Update, January 2022
The PHP Foundation started its work at the end of November as a non-profit organization whose mission is to ensure the long life and prosperity of the PHP language.
We already have the first results. Applications for sponsorship from core developers have been received and are being processed.
The foundation team will be publishing monthly updates so you can subscribe to our Twitter @thephpf to stay up to date with the news.
To learn more about The PHP Foundation check out the Voices of the ElePHPant Ep 366 podcast with Joe Watkins, Sara Golemon, and Sebastian Bergmann.
- PHP 8.0.15, PHP 8.1.2, PHP 7.4.27
Bug fixes for current PHP branches have been released. In the case of PHP 7.4 this is the last regular release, and from now on only security updates will be issued for the PHP 7.4 branch.
- PHP version stats: January, 2022
Here are some fresh stats for PHP versions according to packagist.org. Version 8.1 only came out two months ago, but it’s already gained a 9.1% share. However, there’s still a lot of PHP 7.4 (44%).
- [RFC] User Defined Operator Overloads
A proposal to add operator overloading to PHP failed to pass the vote. You can, however, listen to the PHP Internals News podcast with the author Jordan LeDoux to learn the details.
Jordan also published very thorough instructions on How to make an RFC for PHP.
In the meantime, operator overloading can already be used in PHP thanks to lisachenko/z-engine and FFI. For an example of the implementation of operators for matrices, see: lisachenko/native-php-matrix.
- thephpleague/flysystem 3.0.0 – A major update of the popular library for working with file systems. Check out the blog post with all the details.
- Cycle 2.0 – The second major release of Cycle – a DataMapper and ORM for PHP that can be used in both traditional and daemonized PHP applications.
- ankitpokhrel/tus-php 1.0 – Server and client implementation of the tus.io, an open protocol for renewable file uploads. The protocol is used, for example, in Vimeo and Cloudflare.
- Infection PHP 0.26.0 – An update to the PHP mutation testing framework. The new version adds HTML reports, mutation of only changed strings, and more.
- Doctrine ORM 2.11 – The update brings support for enumerations, virtual columns, read-only properties, nested attributes, and more.
- Roave/BetterReflection 5.0 – Improved Reflection API: you can get information without loading classes, from closures, and much more. The new version adds support for PHP 8.1 and has better performance.
- viewi/viewi – A powerful tool for creating reactive applications using only PHP and HTML. In essence, it’s a server-side template engine + frontend framework. But the zest is that you describe all components and logic in PHP and then the tool transpiles them into native JS.
- Roach PHP – A tool for web scraping inspired by the popular Python library, Scrapy.
- symfony/html-sanitizer – A new component to clean up untrusted HTML and protect against XSS. It could be a good alternative to HTML Purifier.
- EventSaucePHP/ObjectHydrator – A library for hydrating raw data (like JSON) into objects.
- ajthinking/archetype – A simple interface for modifying PHP files/classes.
- framjet/php-enum-bitmask – Using enumerations from PHP 8.1 as bitmasks.
- beyondcode/httpdump – Laravel application for debugging incoming HTTP requests (debugging web hooks, etc.). Creates random URLs and dumps all the requests to them in a nice way. You can see it in action at httpdump.app.
- spatie/ignition – This library for displaying debugging error pages, familiar to many from Laravel, but now framework-independent, has been updated and can be used in any application. See the overview blog post.
- chevere/xr – A debug server on ReactPHP, inspired by the spatie/ray, but instead of a desktop application it’s just a CLI command to run. Video demo.
- JustSteveKing/php-sdk, Sammyjo20/Saloon – Two similar libraries with the same idea: simplify SDK creation for services or organize access to different APIs in the common style.
- AliSaleem27/wordle-cl – A CLI version of the popular five-letter word guessing game Wordle.
- staabm/phpstan-dba – An extension for PHPStan that checks the validity of SQL queries in
- flow-php/etl – An implementation of the Extract Transform Load pattern to use in your PHP application. Check out the thread from the author to learn more.
- The symfony-cli tool has been open-sourced
In addition to Symfony-specific tasks, the tool includes a local server, which can be used as a modern alternative to MAMP/WAMP. It supports multiple versions of PHP (each project can specify its own), has integration with Docker, local domains, and automatic HTTPS. The tool is implemented in Go, and is available for Linux, macOS, and Windows.
- A better way to quickly start Symfony projects
- Introducing the Symfony 6 Certification – 90 minutes for 75 questions from 15 topics.
- Organizing your Symfony project tests
- The key concepts of Symfony’s Security package in 5 minutes
- Symfony Messenger <3 systemd
- Use PHP Enums as Doctrine type in Symfony
- Build Symfony and Doctrine ORM Applications with ease using Ecotone
- norberttech/static-content-generator-bundle – The tool generates static HTML pages from your Symfony application.
- Using custom PHP attributes for registering and configuring Symfony Messenger handlers
- JSON Columns and Doctrine DBAL 3 Upgrade
- Laracon Online is on Feb 9, and it’s free
The conference is usually paid, but this Laracon Online Winter will be broadcast free on YouTube.
- Building a multi-room chat application with Laravel and Centrifugo
- Managing Laravel services
- Laravel Pseudo-Daemons
- Primitive Types in Controllers and Closure Routes
- How to scale Laravel project on AWS without breaking the bank.
- LaravelDaily/Laravel-Roadmap-Learning-Path – A systematic collection of materials for learning Laravel from simple to complex.
- Building an API using TDD in Laravel
- Efficient Pagination Using Deferred Joins
- 45 New Laravel Tips 2022
- Yii 1.1.25 – The first version of the Yii framework is not actively developed, but compatibility fixes are still coming out. This update fixes a few for PHP 8.0.
- The first stable releases for some Yii 3 components have also been released: yiisoft/user, yiisoft/translator-extractor, yiisoft/config, yiisoft/yii-swagger, yiisoft/widget, yiisoft/router.
- Yii news 2021, issue 4
- Trying out PHP after 7 years of working with Java.
- PHP in 2022 – Brent Roose’s traditional ecosystem overview.
- Heaps explained in PHP
- Implementation of Chain of Responsibility Design Pattern in PHP
- async & await at the edge with ReactPHP – PHP 8.1 with fibers support is out! One of the ReactPHP maintainers writes about how they’re used. In particular, the new
React\Async\awaitfunctions have been added.
- PHP Benchmark: include() vs file_get_contents() –
include()can be faster than
file_get_contents()if you tweak the Opcache settings.
- Where does my validation live?
- How to build maintainable PHP applications and decouple business logic from the frameworks.
- Making sense of the 8 log levels in PHP – You’ll most likely only need four.
- Overriding vendor classes – If you don’t want to create a fork, you could properly configure autoloading in composer.json. Or as an option, you can also use patches with cweagans/composer-patches.
- Accessing private properties in PHP – Instead of reflection and access through
Closure::bindyou can cast object to array (but should you?).
- Sometimes it can be useful to look at the generated opcodes to understand what is going on in the code. The command
phpdbg -p* file.phpwill help.
To better understand how a snippet of #PHP code works internally, you can use `phpdbg -p* file.php` to dump the opcodes.
— Patrick Allaert PHP 8.1 RM (@AllaertPatrick) January 4, 2022
Thanks for reading!
If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send me a tweet.
Your JetBrains PhpStorm team
The Drive to Develop