I do not think they are forgotten they just have a bad reputations... nuance. I know about them but if I stumble on them during a codebase review they will be the first I ask to refactor to a more maintainable and readable code.
I do not think they are forgotten they just have a bad reputations... nuance. I know about them but if I stumble on them during a codebase review they will be the first I ask to refactor to a more maintainable and readable code.
A straight forward package in PHP to parse, manipulate and generate The Cache-Status HTTP Header Field. github.com/bakame-php/h... #php #http-cache-status #http-structured-fields
nyamsprod.com/blog/dealing... a new blog post explaining the new fetures in the #PHP #URI Toolkit but also encourage developers to participate in shaping the future of PHP
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.
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...
Last release of the year #CSV github.com/thephpleague... also last release which supports #PHP8.1 . It adds Enum formatting support on writing
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
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
This is now live and for everyone to use just do `composer require league/uri-polyfill league/uri-component` and you will be good to go with version 7.6
I am very happy to announce that the League #URI toolkit for #PHP developers 7.6 has been released!
This release includes a new uri-polyfill package, a new URN object, a new FragmentDirectives object and tons of improvements please check the uri.thephpleague.com for more information
Also I remember creating this Calendar object with Period based on an article from your team π
gist.github.com/nyamsprod/c1...
I did this for the Period package and it works like a charm
github.com/thephpleague...
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.
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 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.
Finishing adding these imports everywhere in league/uri codebase version 7.6 is almost ready!! #PHP #URI #OSS
#thephpleague
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
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
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.
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...
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.
Coming in the next minor version of #LeagueCSV the JsonConverter #ndjson support is improved you can now do the following #php #csv #oss
New minor versions of the league/uri packages are coming in a couple of weeks. They will contain new features and deprecations. Please head over the documentation site or play around with the dev-master and report bugs or regressions now. #PHP #URI #OOS uri.thephpleague.com
PHP warnings:
Sometimes harmless π€·
Sometimes critical π₯
Always annoying π
My fix: a Warning class to cloak or trap them, once and for all.
nyamsprod.com/blog/dealing...
#php #warnings #error_handling
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.
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
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.
I hope theses examples explain the goal. To have total control over the functions behaviour.
That what does it wraps them
`fopen` returns false on error ... so fopen is a code smell is that what you are saying π€ and that's the case for most php internal functions. so the solution is for a known behaviour of PHP not for userland code where I do not expect developer to use E_USER_WARNING + false but rather exceptions
because the method already return false why would I want to know twice that there's a error ... If the function was returning an Error like a ValueError I would not have to suppress anything. I already know I have false returned it's twice the same information for no real added value.
A code smell ? Why ?
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.
I usually hate traits but I hate even more the PHP error control operator so I made this trait #PHP #trait
I created a new package called #stackwatch and If someone is interested I have 3 open issues on #stackwatich which I need help for github.com/bakame-php/s... to tag the first stable version.
Of course feel free to add more issues if you test the package #php #profiling
Periodic reminder: stop using boolean as options flags in #PHP use Enum instead. Boolean flags are hard to read and to remember and lead to tricky bugs and requiring a trip to the method/function definition, Enum are explicit and readable and offer granularity instead of a simple yes/no answer
I have updated my RFC around data encoding in PHP to allow users to migrate to the new API. wiki.php.net/rfc/data_enc... comments and remarks are welcomed #PHP #RFC #base64 #base16 #base58 #base32
github.com/bakame-php/a... is almost stable if you could give a spin an report issues or improvement it would be nice. It is a nice non brainer straightforward profiler in PHP which seats between Xdebug and you double call to microtime π Give it a shot. #PHP #profiler #OSS
An entry level package to profile your code it's not #xdebug but it does the job needed github.com/bakame-php/a... #php #profiling #memoryusage #microtime