Posts about PHP
Moving packages to Arokettu
Just finished moving my old composer packages from
I tried to make the migration process as smooth as possible. I'm sorry for the inconvenience it might have caused.
Installing Composer in Docker the 2020-s Way
While the original way is still valid, in Docker it's now easier to copy the Composer executable from its Docker image.
or for PHP < 7.2.5
Please note that without the installer, dependencies won't be checked, so you also need to install git and/or zip, and preferably optional dependencies like mbstring too.
Found accidentally on the Stack Overflow. There is also another interesting and underliked method for the case when you don't want to keep the composer executable and cache files in your image.
I have recently found myself in a situation when 3 out of 4 libraries that I used to work with Excel files were abandoned:
akeneo-labs/spreadsheet-parser (streaming reader) had no commits in 4 years
mk-j/php_xlsxwriter (streaming writer) had no commits in 2 years
box/spout (streaming reader/writer) is formally abandoned
Luckily there exists a community fork of Spout called OpenSpout and it can replace them all. It seems pretty popular with 1 mln downloads and 229 stars but it's still less popular than the original and I managed to find it only by navigating the forks of Spout so I think it just needs more exposure.
PHP 8.2 and my achievement
A small step for the community may still be a huge leap for specific people, like Pierrick Charron and Sergey Panteleev who became this version release managers. I would like to congratulate them with a successful release.
This moon-in-reverse scale leap also happened to me: I got my first MR accepted to the PHP itself. It's the second C-based project that I contributed professionally, and the only huge one. The first one was my systemd-journal lib wrapper.
PHP 8.2 and my libraries
I have re-tested all my libraries for compatibility with PHP 8.2. Luckily due to small amount of changes and, well, me not using some bad practices, they are all compatible with the new release.
Only MonsterID had a new release to leverage the new Random Extension.
PHP 8.2 Released
PHP 8.2 has been released. It's a relatively small release by new features. I already covered some of them. Here are things that I would like to highlight:
Unsigned is a fixed (but arbitrary) length unsigned integer arithmetic library for native PHP. It was created as a helper for the Random Extension Polyfill to remove hard dependency on the GMP. It may be useful for weird arithmetic with shifts and unsigned overflows that is used in RNGS, encryptors, hashes, etc. (But it won't be cryptographically secure! Time based attacks are quite possible because of some optimizations) Performance greatly depends on the PHP version, with PHP 8.0+ it performs quite nicely, only slightly slower than GMP.
Polyfill for Random Extension
Announcing my new library, a polyfill for the new sexy
ext-randomfrom PHP 8.2 that I mentioned a couple of posts ago. It requires PHP 7.1+ and the GMP extension.
There will be some limitations with the compatibility but it's already usable for most simple use cases. Grab it here: https://sandfox.dev/php/random-polyfill.html
Many thanks to Go Kudo for his work on the original extension.
Early Look at PHP 8.2
It's a month before the feature freeze so we can predict what the release will look like. So far it seems like an underwhelming release without any killer features. It still has very nice language improvements.
These are the things I would like to highlight:
License Manager for Composer
I found myself in a need to filter away some licenses for my dependencies (AGPL, I'm looking at you). I've found a well known plugin for that: metasyntactical/composer-plugin-license-check.
The problem that I found with it is that it doesn't prevent you from installing blacklisted packages. I mean it was designed to do that but fails on Composer 2.0+.
I started investigating for the ways to fix that but ended up with a feature complete plugin. It also offers some more flexibility in the config.
Grab it here: https://sandfox.dev/php/composer-license-manager.html