PSL 6.0.0
PSL 6.0 is the biggest release in the project's history. New home, new packages, new capabilities.
A new home
PSL has moved. The repository, the organization, the website - everything has a new address:
- Repository: github.com/php-standard-library/php-standard-library (was
azjezz/psl) - Website: php-standard-library.dev (was
psl.carthage.software) - Packagist:
php-standard-library/php-standard-library(wasazjezz/psl)
The azjezz/psl package is now abandoned. Run composer require php-standard-library/php-standard-library to switch.
The namespace has not changed. It is Psl\, and it will always remain Psl\.
61 standalone packages
PSL is now split into 61 independently installable packages. You no longer need to pull in the entire library.
Need just type-safe coercion? composer require php-standard-library/type
Building an async TCP server? composer require php-standard-library/tcp
Working with URIs? composer require php-standard-library/uri
Every package declares its own dependencies, so you only get what you actually use. The full library install still works for those who want everything:
composer require php-standard-library/php-standard-libraryAll 61 packages live under the php-standard-library GitHub organization, each with its own read-only split repository for Composer.
New components
URI, IRI, URL
Full RFC-compliant resource identifier handling:
- URI - RFC 3986 parsing, normalization, reference resolution, and RFC 6570 URI Template expansion (Levels 1-4)
- IRI - RFC 3987 Internationalized Resource Identifiers with Unicode support, Punycode, and IDNA 2008
- URL - Strict URL type with scheme/authority validation and default port stripping
Punycode
Standalone RFC 3492 Punycode encoding and decoding for internationalized domain names.
Cancellation tokens
A new cancellation system replaces the old Duration $timeout pattern across all async/IO operations:
CancellationTokenInterface- base contractTimeoutCancellationToken- auto-cancels after a durationSignalCancellationToken- manually triggered cancellationLinkedCancellationToken- cancelled when either of two inner tokens fires
More highlights
TaskGroupandWaitGroupfor structured concurrencyQuotedPrintableandEncodedWordencoding (RFC 2045, RFC 2047)- Streaming Base64/Hex/QuotedPrintable IO handles
TLS\Listenerfor wrapping any listener with TLSTCP\RestrictedListenerfor IP/CIDR-based access controlNetwork\CompositeListenerfor accepting from multiple listenersBufferedReadHandleInterfacewithreadByte(),readLine(),readUntil()- Configuration objects for TCP, Unix, UDP, and Socks
Breaking changes
This is a major release with breaking changes. The most impactful:
Cancellation replaces timeouts. All null|Duration $timeout parameters are now CancellationTokenInterface $cancellation = new NullCancellationToken().
// Before (5.x)
$data = $reader->read(timeout: Duration::seconds(5));
// After (6.0)
$data = $reader->read(cancellation: new Async\TimeoutCancellationToken(Duration::seconds(5)));Naming conventions. All variables, parameters, and properties now use $camelCase.
Configuration objects. TCP\listen(), TCP\connect(), Unix\listen(), UDP\Socket::bind(), and Socks\Connector now accept configuration objects instead of individual parameters.
Removed timeout exceptions. IO\Exception\TimeoutException, Network\Exception\TimeoutException, Process\Exception\TimeoutException, and Shell\Exception\TimeoutException are removed. Use Async\Exception\CancelledException instead.
TLS renamed. TLS\ServerConfig -> TLS\ServerConfiguration, TLS\ClientConfig -> TLS\ClientConfiguration.
See the full CHANGELOG for the complete list.
Bug fixes
RetryConnectorbackoff sleep now respects cancellation tokensIO\write(),IO\write_line(),IO\write_error(),IO\write_error_line(), andStr\format()no longer crash when the message contains%characters and no arguments are passed
Thank you
PSL is built by its community. Thank you to everyone who contributed code, reported bugs, sponsored the project, or simply used it in production.