Sign in

Ignace Nyamagana Butera

@nyamsprod.com
207 followers 22 following 96 posts

Software developer. Creator of PHP centric package like league/csv, league/uri and bakame/http-structured-fields. Sponsor me at github.com/sponsors/nyamsprod

PostsRepliesMedia
Ignace Nyamagana Butera @nyamsprod.com · 10/09/2026
What if URI Templates could work both ways? Template → URI Template ← URI With the next minor version of league/uri, you will be able to extract variables from a URI into an ExtractionResult. Same template. Both directions. #PHP #URI #URITemplate
PHP code showing URI Template extraction with League\Uri. A template contains repeated variables, including {term:1} and {term}, plus an exploded query variable {q*}. The URI /1.1/search/j/john/?q=a&q=b&limit=10 is extracted into an ExtractionResult, producing version "1.1", term "john", q as ["a", "b"], and limit "10".
010
Ignace Nyamagana Butera @nyamsprod.com · 20/08/2026
league/csv warnings on the README page are getting bigger on each PHP version upgrade 😂 😂 #PHP86 #maintenance #CSV
000
Ignace Nyamagana Butera @nyamsprod.com · 18/07/2026
The Duration class in Tokei 0.2.0 introduces the modulo() and dividedInto() methods that provide an easy way to retrieve the remainder of a duration division. This is especially useful when dealing with circular ranges. #duration #localtime #php #circular-range bakame-php.github.io/tokei/
Example demonstrating the difference between Duration::modulo() and the remainder returned by Duration::dividedInto(). For a positive duration of 3 hours and 35 seconds divided by 1 hour, both methods return a remainder of 35 seconds. For the negated duration, modulo() returns a positive remainder (59 minutes and 25 seconds), while dividedInto()->remainder preserves the sign of the original duration and returns −35 seconds.
000
Ignace Nyamagana Butera @nyamsprod.com · 11/04/2026
Did you know that you can map #CSV row to DTO using league/csv ? in the next version you will be able in #PHP8.5+ to use a static closure to allow specific casting rules
The script shows how using the League/csv package you will be able in the next minor version to use in PHP8.5+ closure to further specify row cell casting to DTO properties so that each CSV record is converted into a fully PHP typed structure.
001
Ignace Nyamagana Butera @nyamsprod.com · 16/01/2026
I just released version 7.8.0 of all my #PHP #URI packages. The new version adds support for BackedEnum everywhere, improve string coercion and allow migrating and mitigating the BC breaks introduced in http_build_query in #PHP8.4 full changelog github.com/thephpleague...
This example show the usage of the new QueryString::compose method with the new QueryComposeMode Enum.  It highlights the different ways to compose an query string to better migrate between the BC breaks in http_build_query  behaviours .
the QueryComposeMode::Native mode just encode using http_build_query so it is PHP version dependent.
020
Ignace Nyamagana Butera @nyamsprod.com · 08/12/2025
League URI Toolkit 7.7.0 is released. 🎉 - It fixes a regression introduced in version 7.6.0 - adds a redact URI components API via the Modifier class - Improve host parsing and host handling Learn more on the uri.thephpleague.com documentation website. #PHP #URI #OSS
The picture shows some of the new features and fixes added to the package. Like the public Redact API and the improved path modification. see more on the documentation website
000
Ignace Nyamagana Butera @nyamsprod.com · 29/10/2025
Here's a sneak peak at what you will be able to do with version 7.6 of the PHP league uri toolkit. The toolkit adds support for the new PHP URI extension and gives you a nice API to work with URI in PHP. learn more on uri.thephpleague.com #PHP #URI #RFC3986 #WHATWGURL
The League\Uri\Modifier class wraps any URI object and perform the correct modification on the wrapped URI. After any applied modification you can access the changed URI using the Modifier::unwrap() method.
The method will always return an URI of the same instance of the one you give to the Modifier::wrap method.
The Modifier class works for League Uri own URI class but also for PSR-7 UriInterface implementing classes and PHP's new native URI classes.
020
Ignace Nyamagana Butera @nyamsprod.com · 24/10/2025
Finishing adding these imports everywhere in league/uri codebase version 7.6 is almost ready!! #PHP #URI #OSS #thephpleague
The image highlights the addition of import definition for PHP new native URI extension in league/uri codebase. This extension will always be available when PHP8.5 is released and support for them is being added to league/uri.
010
Ignace Nyamagana Butera @nyamsprod.com · 15/10/2025
There's a new league/uri package in town guess which one it is ? uri.thephpleague.com It will be release with version 7.6 of all the other packages 🥳 #PHP #URI #polyfill special thanks to github.com/TimWolla, github.com/kocsismate and github.com/TRowbotham for the help and support
The league URI toolkit has a new package ready to be released named uri-polyfill and it brings PHP's new URI extension to PHP8.1+ version
000
Ignace Nyamagana Butera @nyamsprod.com · 14/10/2025
Coming in the next version of league/csv named constructors simplification. All the current named constructors are deprecated in favor of just two. which will simplify the user choice and improve DX #csv #php #oss #thephpleague Read the doc for more informations csv.thephpleague.com/9.0/connecti...
All the current named constructors are being deprecated and replaced by 2 simple named constructors that are easier and more powerful to work with.
For instance Reader::createFromString is replaced by Reader::fromString
and all the other methods are replaced by the more easy to use Reader::from.
010
Ignace Nyamagana Butera @nyamsprod.com · 26/09/2025
Coming in the next minor version of #LeagueCSV the JsonConverter #ndjson support is improved you can now do the following #php #csv #oss
You load a CSV written in french iso-8895-15 and using the ";" as delimiter
You first load the CSV document. 
Then using the stream feature you convert on the fly the document into UTF-8 using mb_string extension. 
You convert and store the CSV document as a NDJson file using a list with a header. Last but not least you convert the strings into integer where it makes sense using the JsonConverter formatter capabilities.
000
Ignace Nyamagana Butera @nyamsprod.com · 05/09/2025
A new version of #stackwatch is out with tons of new features, fixes and removal for instance the new version nows comes with a PHPUnit helper traits to ease testing callback or method performances. See more on the documentation website bakame-php.github.io/stackwatch/ #php #profiling #OOP
A fluent, unit-aware PHPUnit helper for asserting profiler metrics. Straightforward to use by adding a simple trait to your PHPUnit test class. And Since all the data are in bytes or nanoseconds you can assert using other units and they will be automatically converted into the proper unit.
010
Ignace Nyamagana Butera @nyamsprod.com · 19/08/2025
I hope theses examples explain the goal. To have total control over the functions behaviour.
The Warning class is a utility for controlling PHP warnings during the execution of callbacks. It provides two static methods:

trap() — converts any PHP warning (E_WARNING or E_USER_WARNING) emitted by the callback into an ErrorException, allowing them to be caught and handled like regular exceptions.

cloak() — suppresses warnings emitted by the callback, effectively hiding them during execution.

Both methods ensure that the original error handler is restored after the callback executes, and they propagate any exceptions thrown directly by the callback.
110
Ignace Nyamagana Butera @nyamsprod.com · 18/08/2025
I usually hate traits but I hate even more the PHP error control operator so I made this trait #PHP #trait
This PHP trait safely executes a callback while suppressing PHP warnings and notices during its execution.

Useful for calling functions or methods that may trigger non-critical errors without interrupting program flow like most PHP internal functions.
110
Ignace Nyamagana Butera @nyamsprod.com · 28/02/2025
League/csv 9.22.0 is out with a new class the Buffer which enable buffering and performing CRUD operation on your data. Please read the documentation csv.thephpleague.com/9.0/writer/b... and the release notes for more github.com/thephpleague... #php #csv #leagueCSV
The Buffer class loads the first 1000 rows of the CSV Reader object. Delete records where the rating is equal to 0.
Update records without tags and a the book and the sci-fi tags
And insert a new record that was not present
Finally, the buffer is stored in a new CSV document with the update made to it.
000
Ignace Nyamagana Butera @nyamsprod.com · 18/01/2025
OK this still need some ironing but... in #LeagueCSV 9.22.0 a new interface is added `TabularData` which enables the following magic 😍 #PHP #interoperability #extension #tabulardata for more information and limitations check the documentation csv.thephpleague.com/9.0/reader/r...
The picture illustrate how you can user League\CSV package to directly interact with popular RDBMS system in PHP to turn any query result into a object processable by the package.
020
Ignace Nyamagana Butera @nyamsprod.com · 08/01/2025
#LeagueCSV 9.21.0 is out with a full rewrite of the exposed #PHP stream filter API to improve its usage. github.com/thephpleague...
The new stream filter API using the League\Csv\Writer object. You can register any callback and attach it to the object in a read or write mode depending on the situationThe API can be use with native PHP stream resource too register, append or remove the stream filter
000
Ignace Nyamagana Butera @nyamsprod.com · 04/01/2025
One of the most underrated, under-used, unknown feature of #PHP is the powerful PHP stream filter API with the weirdest class of them all www.php.net/php_user_fil... I use them heavily in #LeagueCSV 😈 and they are getting a clean fresh API in the next minor version to improve their usages
Enabling parsing a file using the carriage return character as end of line character using PHP stream filter via the new CallbackStreamFilter class in League/CSV in the upcoming release 9.21.0
010
Ignace Nyamagana Butera @nyamsprod.com · 03/01/2025
Coming to the next minor version of #LeagueURI more string representation to help you display your URI the right way #php #URI
020
Ignace Nyamagana Butera @nyamsprod.com · 21/12/2024
Periodic reminder: The PHP parse_url function splits the URL in its different components. It does not validate the URL. To correctly validate an URL you are required to use an URL validator per scheme. #php #URL #URI
parse_url tries to split an URL into its defined component. It does not validate the URL. You need an URL validator for that
020
Ignace Nyamagana Butera @nyamsprod.com · 17/12/2024
Did you know you could treat a query string a la #php or a la #javascript using #LeagueURI component package
Processing a query string in PHP using PHP or Javascript algorithm
062
Ignace Nyamagana Butera @nyamsprod.com · 14/12/2024
Did you know you could do the following with #leagueCSV ? The result is a Iterator containing the records which match the query. #php #csv #query-builder
query a CSV document using league/csv query builder
0153
Ignace Nyamagana Butera @nyamsprod.com · 10/12/2024
Coming in the next minor version of #LeagueCSV generating #CSV without enclosure. Like Uncle Ben used to say ... with great power comes great responsability. This should be used wisely with a lot of precaution. #php
A script that shows how to generate a CSV document without enclosure character using League/csv
010
Ignace Nyamagana Butera @nyamsprod.com · 08/12/2024
#LeagueURI packages are all bumped to 7.5.1 adding support for PHP8.4 Deprecated attributes and fixing query string parsing issues. See the documentation for more information. #uri #php #query-string uri.thephpleague.com/interfaces/7...
A comparison between parse_str query parsing and League QueryString extract method which does the same without mangling the results
000
Ignace Nyamagana Butera @nyamsprod.com · 23/11/2024
using @nicolasgrekas.bsky.social suggestion while updating league/csv codebase to take advantage of the new Deprecated attribute in PHP8.4
040