azjezz/psl
PSL is a modern, well-typed standard library for PHP 8.4+, inspired by HHVM’s HSL. It offers safer, predictable APIs for async, collections, networking, I/O, crypto, terminal UI, and robust data validation—replacing brittle built-ins with consistent alternatives.
Str\chr() now throws OutOfBoundsException for invalid Unicode code points instead of silently returning an empty stringStr\from_code_points() now validates code points and throws OutOfBoundsException for out-of-range values, surrogates, and negative inputs instead of producing invalid UTF-8; implementation now delegates to Str\chr() for consistent behaviorwidth(), truncate(), and width_slice() PHPDoc to explicitly reference mb_strwidth()/mb_strimwidth() semanticsPsl\IO\BufferedWriteHandleInterface, extending WriteHandleInterface with flush() for handles that buffer data internally before writing to an underlying resourceCompression component with streaming compression/decompression abstractions for IO handles. Provides CompressorInterface, DecompressorInterface, four handle decorators (CompressingReadHandle, CompressingWriteHandle, DecompressingReadHandle, DecompressingWriteHandle), and convenience functions compress() and decompress()HPACK component - RFC 7541 HPACK header compression for HTTP/2H2 component - HTTP/2 binary framing protocol implementationCache component - async-safe in-memory LRU cache with per-key atomicity via KeyedSequence, proactive TTL expiration via event loopnull|Duration $timeout parameters across IO, Network, TCP, TLS, Unix, UDP, Socks, Process, and Shell components have been replaced with CancellationTokenInterface $cancellation = new NullCancellationToken(). This enables both timeout-based and signal-based cancellation of async operations.Psl\IO\Exception\TimeoutException - use Psl\Async\Exception\CancelledException instead.Psl\Network\Exception\TimeoutException - use Psl\Async\Exception\CancelledException instead.Psl\Process\Exception\TimeoutException - use Psl\Async\Exception\CancelledException instead.Psl\Shell\Exception\TimeoutException - use Psl\Async\Exception\CancelledException instead.Psl\IO\CloseHandleInterface now requires an isClosed(): bool method.Network\SocketInterface::getLocalAddress() and Network\StreamInterface::getPeerAddress() no longer throw exceptions. Addresses are resolved at construction time and cached, making these O(1) property lookups with no syscall.BufferedReadHandleInterface::readLine() now always splits on "\n" instead of PHP_EOL. Trailing "\r" is stripped, so both "\n" and "\r\n" line endings are handled consistently across all platforms. Use readUntil(PHP_EOL) for system-dependent behavior.Psl\TLS\ServerConfig renamed to Psl\TLS\ServerConfiguration.Psl\TLS\ClientConfig renamed to Psl\TLS\ClientConfiguration.$camelCase naming instead of $snake_case.TCP\listen(), TCP\connect(), TCP\Socket::listen(), TCP\Socket::connect() now accept configuration objects (TCP\ListenConfiguration, TCP\ConnectConfiguration) instead of individual parameters for socket options.Unix\listen() and Unix\Socket::listen() now accept Unix\ListenConfiguration instead of individual parameters.UDP\Socket::bind() now accepts UDP\BindConfiguration instead of individual parameters.TCP\Socket setter/getter methods (setReuseAddress, setReusePort, setNoDelay, etc.) have been removed. Use configuration objects instead.TCP\Connector constructor now accepts TCP\ConnectConfiguration instead of bool $noDelay.Socks\Connector constructor changed from (string $proxyHost, int $proxyPort, ?string $username, ?string $password, ConnectorInterface $connector) to (ConnectorInterface $connector, Socks\Configuration $configuration).ingoing to ongoing across Semaphore, Sequence, KeyedSemaphore, and KeyedSequence (hasIngoingOperations() -> hasOngoingOperations(), getIngoingOperations() -> getOngoingOperations(), etc.).Psl\Async\CancellationTokenInterface for cancelling async operationsPsl\Async\NullCancellationToken - no-op token used as default parameter valuePsl\Async\SignalCancellationToken - manually triggered cancellation via cancel(?Throwable $cause)Psl\Async\TimeoutCancellationToken - auto-cancels after a Duration, replacing the old Duration $timeout patternPsl\Async\LinkedCancellationToken - cancelled when either of two inner tokens is cancelled, useful for combining a request-scoped token with an operation-specific timeoutPsl\Async\Exception\CancelledException - thrown when a cancellation token is triggered; the cause (e.g., TimeoutException) is attached as $previous. Use $e->getToken() to identify which token triggered the cancellation.Async\sleep() now accepts an optional CancellationTokenInterface parameter, allowing early wake-up on cancellationAwaitable::await() now accepts an optional CancellationTokenInterface parameterSequence::waitFor() and Sequence::waitForPending() now accept an optional CancellationTokenInterface parameterSemaphore::waitFor() and Semaphore::waitForPending() now accept an optional CancellationTokenInterface parameterKeyedSequence::waitFor() and KeyedSequence::waitForPending() now accept an optional CancellationTokenInterface parameterKeyedSemaphore::waitFor() and KeyedSemaphore::waitForPending() now accept an optional CancellationTokenInterface parameterSenderInterface::send() and ReceiverInterface::receive() now accept an optional CancellationTokenInterface parameterListenerInterface::accept() now accepts an optional CancellationTokenInterface parameterTCP\ListenerInterface::accept() now accepts an optional CancellationTokenInterface parameterUnix\ListenerInterface::accept() now accepts an optional CancellationTokenInterface parameterTLS\Acceptor::accept(), TLS\LazyAcceptor::accept(), TLS\ClientHello::complete(), and TLS\Connector::connect() now accept an optional CancellationTokenInterface parameter - cancellation propagates through the TLS handshakeTLS\TCPConnector::connect() and TLS\connect() now pass the cancellation token through to the TLS handshakePsl\Async\TaskGroup for running closures concurrently and awaiting them all with defer() + awaitAll()Psl\Async\WaitGroup, a counter-based synchronization primitive with add(), done(), and wait()Psl\Encoding\QuotedPrintable\encode(), decode(), and encode_line() for RFC 2045 quoted-printable encoding with configurable line length and line endingPsl\Encoding\EncodedWord\encode() and decode() for RFC 2047 encoded-word encoding/decoding in MIME headers (B-encoding and Q-encoding with automatic selection)TLS\ListenerInterface and TLS\Listener, wrapping any Network\ListenerInterface to perform TLS handshakes on accepted connectionsBase64\Variant::Mime for RFC 2045 MIME Base64 with 76-char line wrapping and CRLF, using constant-time encoding/decodingEncodingReadHandle, DecodingReadHandle, EncodingWriteHandle, DecodingWriteHandle), QuotedPrintable (same 4), and Hex (same 4), bridging Psl\IO and Psl\Encoding for transparent encode/decode on read/writePsl\IO\BufferedReadHandleInterface, extending ReadHandleInterface with readByte(), readLine(), readUntil(), and readUntilBounded()Psl\IO\Reader now implements BufferedReadHandleInterfaceTCP\ListenConfiguration and TCP\ConnectConfiguration with immutable with* builder methodsUnix\ListenConfiguration with immutable with* builder methodsUDP\BindConfiguration with immutable with* builder methodsSocks\Configuration with immutable with* builder methods for proxy host, port, and credentialsTCP\RestrictedListener, wrapping a listener to restrict connections to a set of allowed IP\Address and CIDR\Block entriesNetwork\CompositeListener, accepting connections from multiple listeners concurrently through a single accept() callURI component - RFC 3986 URI parsing, normalization, reference resolution, and RFC 6570 URI Template expansion (Levels 1–4), with RFC 5952 IPv6 canonical form and RFC 6874 zone identifiersIRI component - RFC 3987 Internationalized Resource Identifier parsing with Unicode support, RFC 3492 Punycode encoding/decoding, and RFC 5891/5892 IDNA 2008 domain name processingURL component - strict URL type with scheme and authority validation, default port stripping for known schemes, and URI/IRI conversionPunycode component - RFC 3492 Punycode encoding and decoding for internationalized domain namesRetryConnector backoff sleep now respects cancellation tokens, allowing retry loops to be cancelled during the delayIO\write(), IO\write_line(), IO\write_error(), IO\write_error_line(), and Str\format() no longer pass the message through sprintf/vsprintf when no arguments are given, preventing format string errors when the message contains % charactersReplace Duration timeout parameters with TimeoutCancellationToken:
// Before (5.x)
$data = $reader->read(timeout: Duration::seconds(5));
// After (6.0)
$data = $reader->read(cancellation: new Async\TimeoutCancellationToken(Duration::seconds(5)));
For manual cancellation (e.g., cancel all request IO when a client disconnects):
$token = new Async\SignalCancellationToken();
// Pass to all request-scoped IO
$body = $reader->readAll(cancellation: $token);
// Cancel from elsewhere
$token->cancel();
Reader::readUntilBounded(string $suffix, int $max_bytes, ?Duration $timeout) method, which reads until a suffix is found, but throws IO\Exception\OverflowException if the content exceeds $max_bytes before the suffix is encountered - #620 - by @azjezzIO\Exception\OverflowException exception class - #620 - by @azjezzType\json_decoded() type for transparent JSON string coercion - #619 by @veeweeType\nullish() type for optional-and-nullable shape fields - #618 by @veeweeIO\spool() for memory-backed handles that spill to diskIP component with immutable, binary-backed Address value object and Family enumCIDR\Block::contains() now accepts string|IP\AddressTLS\TCPConnector for poolable TLS connectionsTLS\StreamInterface now extends TCP\StreamInterface, enabling TLS streams to be used with TCP\SocketPoolInterfaceNetwork, TCP, Unix) - #585 by @azjezzPsl\Shell internals refactored; dead code removed - #596 by @azjezzPsl\Env\temp_dir() now always returns a canonicalized path - #599 by @azjezzAnsi component - #588 by @azjezzTerminal component - #589 by @azjezzProcess component - #578 by @azjezzBinary component - #598 by @azjezzInteroperability component - #582 by @azjezzTLS component - #585 by @azjezzUDP component - #585 by @azjezzCIDR component - #585 by @azjezzSocks component - #585 by @azjezzPeriod, Interval, TemporalAmountInterface - #595 by @azjezzIO\copy() and IO\copy_bidirectional() - #585 by @azjezzVec\flatten() - #583 by @azjezzCrypto component with symmetric/asymmetric encryption, signing, AEAD, KDF, HKDF, key exchange, and stream ciphers - #607 by @azjezzrange() for float precision - #581 by @azjezzcreate_temporary_file - #580, #597 by @azjezzPsl\Result\wrap() no longer unwraps nested results - #531 by @azjezzPsl\Collection\Map, Psl\Collection\MutableMap, Psl\Collection\Set, and Psl\Collection\MutableSet now have a more natural JSON serialization - #512 by @josh-raiPsl\IO and Psl\File namespaces have been removed to simplify the component's hierarchy - #518 by @azjezzPsl\sequence() function has been removed - #519 by @azjezzcontainer type - #513 by @azjezzint_range type - #510 by @george-steelalways_assert type - #522 by @azjezzsearch_with_keys_opt and search_with_keys functions - #490 by @simon-podlipskyIter and Regex - #528 by @azjezzPsl\Type\positive_int function - #400 by @dragosprotungPsl\Range component - #378 by @azjezzPsl\Str\range, Psl\Str\Byte\range, and Psl\Str\Grapheme\range functions - #385 by @azjezzPsl\Type\uint function - #393 by @azjezzPsl\Type\i8, Psl\Type\i16, Psl\Type\i32, Psl\Type\i64 functions - #392 by @azjezzPsl\Type\u8, Psl\Type\u16, Psl\Type\u32 functions - #395 by @KennedyTedescoPsl\Type\f32, and Psl\Type\f64 functions - #396 by @KennedyTedescoPsl\Type\nonnull function - #392 by @azjezzandThen method - #398 by @veeweePsl\Type\positive_int function, use Psl\Type\uint instead - by @azjezzVec\reproduce and Vec\range return type is always non-empty-list - #383 by @dragosprotungPsl\Type\unit_enum function - [@19d1230](https://github.com/php-standard-library/php-standard-library/commit/19d123074546cc3ebfca18ad666f100e7fad0658) by @azjezzPsl\Type\backed_enum function - [@19d1230](https://github.com/php-standard-library/php-standard-library/commit/19d123074546cc3ebfca18ad666f100e7fad0658) by @azjezzPsl\Type\mixed_vec function - #362 by @BackEndTeaPsl\Type\mixed_dict function - #362 by @BackEndTeaPsl\Type\vec performance - #364 by @BackEndTeaPsl\Type\float, and Psl\Type\num - #367 by @bcremerrevolt-php/event-loop to 1.0.0 - [@c7bf866](https://github.com/php-standard-library/php-standard-library/commit/c7bf866a362b9528934a758981da718408ec15d4) by @azjezzIO\IterableReadHandle - a streaming ReadHandleInterface that lazily consumes an iterable<string> without buffering the entire content in memoryIO\ConcatReadHandle - reads from two handles in sequence, switching to the second when the first reaches EOFIO\JoinedReadWriteHandle - joins a ReadHandleInterface and WriteHandleInterface into a single read-write handle, delegating all operations to the respective underlying handleIO\TeeWriteHandle - writes to two handles simultaneously with backpressure buffering when the second handle is slowerIO\SinkWriteHandle - a /dev/null-like write handle that discards all written dataIO\SinkReadHandle - a read handle that is always at EOF, unlike MemoryHandle('') which only reports EOF after the first readIO\SinkReadWriteHandle - a sink that discards writes and always reports EOF on readsIO\TruncatedReadHandle - reads up to N bytes from an underlying handle, silently reporting EOF when the limit is reachedIO\BoundedReadHandle - reads up to N bytes from an underlying handle, throwing RuntimeException if the underlying handle has more data than the limit allowsIO\FixedLengthReadHandle - reads exactly N bytes from an underlying handle, throwing RuntimeException on premature EOFIO\copy_chunked() and IO\copy_bidirectional_chunked() - variants of IO\copy() and IO\copy_bidirectional() that accept a custom chunk sizeSendConfiguration::$connectionTimeout - per-request maximum duration for establishing a connection (TCP + TLS handshake), using a linked cancellation token'true'/'false' string literals in Type\bool() coercion - #735 by @verwetoMIME component - comprehensive MIME toolkit implementing RFC 2045-2049 and related standards
MediaType, MediaRange, MediaPreferences) per RFC 2045, RFC 6838, RFC 9110Part\Text, Part\Data) per RFC 2045MultiPart\Composite, MultiPart\Alternative, MultiPart\Related, MultiPart\Form, MultiPart\Parser) per RFC 2046, RFC 2387, RFC 7578Headers)ContentDisposition) per RFC 2183cid: URI support (ContentId) per RFC 2392Parameters)Sniff\from_string, Sniff\from_handle)SMIME\Signer, SMIME\Verifier, SMIME\Encryptor, SMIME\Decryptor) per RFC 5652, RFC 8551DKIM\Signer) per RFC 6376, RFC 8301, RFC 8463Message component - RFC 5322 internet message construction, parsing, and serialization
with*() methods (Message) per RFC 5322string|Mailbox|AddressList for conveniencePartInterface from the MIME component per RFC 2045serialize() and parse() accepting string or ReadHandleInterfaceEnvelope) per RFC 5321Mailbox, Group, AddressList with RFC 2047 encoded-word supportSMTP component - RFC 5321 SMTP client with connection pooling, TLS, and authentication
Connection implementing Network\StreamInterface for protocol-level SMTP operationsTransport managing the full SMTP lifecycle: connect, EHLO/HELO, STARTTLS, AUTH, send, RSETTCP\SocketPoolEnhancedStatusCode parsingSendConfigurationDuration or DateTimeInterfaceDeliveryReport for per-recipient rejection trackingPossibleAttackExceptionTransportConfiguration and SendConfiguration with fluent with*() buildersDNS component - async DNS resolution with full protocol support
SystemResolver mirrors OS DNS behavior, usable as a default parameter valueTCPResolverRacingResolver races multiple nameservers concurrently for fastest responseSplitHorizonResolver routes queries by domain name for split-horizon DNSSearchDomainResolver expands short names using search domain listsHostsFileResolver checks the OS hosts file before network queriesCachedResolver decorator with TTL-aware caching via Cache\StoreInterfaceStaticResolver for hardcoded records in tests and developmentHTTPSResolver using the HTTP client (RFC 8484)ResponseCode helper methods: isSuccess(), isError(), isServerError(), isNameError()DNSSEC component - full DNSSEC validation chain
SecureResolver validates RRSIG signatures on every responseTrustChainResolver walks DS/DNSKEY chain from root to target zoneCachedTrustChainResolver caches trust chain results for performanceStaticTrustChainResolver for offline/air-gapped environmentsSignatureFailedException, BrokenTrustChainException, InvalidProofException, UnsignedResponseExceptionHTTP Message component - version-agnostic HTTP message abstractions
Request and Response immutable value objects with streaming body (ReadHandleInterface)FieldMap ordered, case-insensitive header field collection with lazy indexProtocolVersion enum covering HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3Async\Awaitable<FieldMap> for HTTP/2 and chunked HTTP/1.1reason_phrase() function for HTTP/1.x status line serializationwith*() mutation methods on both Request and ResponseTransaction groups the final response with informational (1xx) responses and server push exchangesExchange represents a pushed request/response pair for HTTP/2 server pushHTTP Client component - async HTTP/1.1 and HTTP/2 client with connection pooling
Client with automatic protocol negotiation via ALPN (HTTP/2 preferred, HTTP/1.1 fallback)PooledConnector with HTTP/1.x idle connection reuse and HTTP/2 session sharing across concurrent requestsH2Multiplexer and per-stream H2Stream stateRedirectClient decorator following 301/302/303/307/308 redirects with method rewriting per RFC 9110, cross-origin credential stripping, and auto-referrerRetryClient decorator with configurable exponential backoff and jitter for transport-level failuresSendConfiguration for per-request overrides (body size limits, TLS, protocol versions, tunnel) merged with ClientConfiguration defaultsDeniedDestinationsMiddleware for SSRF protection against private IP ranges (RFC 1918, RFC 4193, loopback, link-local)HandlerInterface / MiddlewareInterface chain with access to peer address and TLS stateClientConfiguration::$proxy using Psl\Socks\ConnectorClientConfiguration::$tunnel with TLS and proxy authenticationnoTunneling host bypass rules (exact match, domain suffix, wildcard)ResponseBodyHandle implementing ReadHandleInterfaceConfiguration replacing deprecated ClientConfiguration and ServerConfiguration
ClientConnection and ServerConnection now accept Configuration in addition to their legacy config typesClientConnection now supports BDP auto-tuning when using Configuration with maxReceiveWindowSize setbindTo option to ConnectConfiguration for binding to a specific local address before connectingbindTo option to ListenConfiguration for binding to a specific local address before listeningwithBindTo() fluent builder method to both ConnectConfiguration and ListenConfigurationconnect() now respects ConnectConfiguration::$bindTo by setting the socket.bindto stream context optionIO\copy() now flushes the writer after copying if it implements BufferedWriteHandleInterface, ensuring no data remains in an internal bufferState::subscribe() and State::invokeCallbacks() no longer capture $this in queued closures, preventing delayed garbage collection of Deferred/Awaitable chainshttp://::1/path) are now correctly parsed as IPHost instead of being misparsed as a registered name with a numeric portmaxConcurrent (peer's limit on our streams) from peerMaxConcurrent (our limit on peer's streams) in StreamTable, preventing the client's own SETTINGS from limiting its outgoing streamsBDPEstimator now produces an initial connection-level WINDOW_UPDATE during initialize() to bring the receive window from the RFC default (65535) up to initialWindowSize, preventing flow-control stalls when many concurrent streams receive data simultaneouslynotifyWindowWaiters() now copies the waiter list before iterating and properly removes satisfied waiters, preventing iteration corruption and memory leaksResourceHandle readable/writable callbacks now null out the suspension reference before calling resume(), preventing "Must call suspend() before calling throw()" errors during handle destructionResourceHandle::doRead() and doWrite() cancellation subscriptions now null out the suspension reference before throwing, preventing double-wake when cancellation and close race during PHP shutdownSocket class -- use ConnectConfiguration::$bindTo or ListenConfiguration::$bindTo instead. Will be removed in PSL 7.0.ClientConfiguration -- use Configuration instead. Will be removed in PSL 7.0.ServerConfiguration -- use Configuration instead. Will be removed in PSL 7.0.Reader::readUntil() and Reader::readUntilBounded() no longer treat empty reads from non-blocking streams as EOF, fixing readLine() returning the entire content instead of individual lines when used with non-blocking streamspackages/{name}/src/Psl/ instead of the non-existent top-level src/Psl/ pathsplitter audit command to verify organization repository settings (wiki, issues, discussions, PRs, tag immutability).BC - removed Psl\Arr component.
BC - removed Psl\Type\is_array, Psl\Type\is_arraykey, Psl\Type\is_bool, Psl\Type\is_callable, Psl\Type\is_float, Psl\Type\is_instanceof, Psl\Type\is_int, Psl\Type\is_iterable, Psl\Type\is_null, Psl\Type\is_numeric, Psl\Type\is_object, Psl\Type\is_resource, Psl\Type\is_scalar, and Psl\Type\is_string functions ( use TypeInterface::matches($value) instead ).
BC - removed Psl\Iter\chain, Psl\Iter\chunk, Psl\Iter\chunk_with_keys, Psl\Iter\diff_by_key, Psl\Iter\drop, Psl\Iter\drop_while, Psl\Iter\enumerate, Psl\Iter\filter, Psl\Iter\filter_keys, Psl\Iter\filter_nulls, Psl\Iter\filter_with_key, Psl\Iter\flat_map, Psl\Iter\flatten, Psl\Iter\flip, Psl\Iter\from_entries, Psl\Iter\from_keys, Psl\Iter\keys, Psl\Iter\map, Psl\Iter\map_keys, Psl\Iter\map_with_key, Psl\Iter\merge, Psl\Iter\product, Psl\Iter\pull, Psl\Iter\pull_with_key, Psl\Iter\range, Psl\Iter\reductions, Psl\Iter\reindex, Psl\Iter\repeat, Psl\Iter\reproduce, Psl\Iter\reverse, Psl\Iter\slice, Psl\Iter\take, Psl\Iter\take_while, Psl\Iter\to_array, Psl\Iter\to_array_with_keys, Psl\Iter\values, and Psl\Iter\zip functions.
BC - signature of Psl\Iter\reduce_keys function changed from reduce_keys<Tk, Tv, Ts>(iterable<Tk, Tv> $iterable, (callable(?Ts, Tk): Ts) $function, Ts|null $initial = null): Ts|null to reduce_keys<Tk, Tv, Ts>(iterable<Tk, Tv> $iterable, (callable(Ts, Tk): Ts) $function, Ts $initial): Ts.
BC - signature of Psl\Iter\reduce_with_keys function changed from reduce_with_keys<Tk, Tv, Ts>(iterable<Tk, Tv> $iterable, (callable(?Ts, Tk, Tv): Ts) $function, Ts|null $initial = null): Ts|null to reduce_with_keys<Tk, Tv, Ts>(iterable<Tk, Tv> $iterable, (callable(Ts, Tk, Tv): Ts) $function, Ts $initial): Ts.
BC - removed bundled psalm plugin Psl\Integration\Psalm\Plugin, use php-standard-library/psalm-plugin package instead.
dropped support for PHP 8.0
BC - signature of Psl\Type\object function changed from object<T of object>(classname<T> $classname): TypeInterface<T> to object(): TypeInterface<object> ( to preserve the old behavior, use Psl\Type\instance_of )
introduced Psl\Type\instance_of function, with the signature of instance_of<T of object>(classname<T> $classname): TypeInterface<T>.
introduced a new Psl\Async component.
refactored Psl\IO handles API.
introduced a new Psl\File component.
refactor Psl\Shell\execute to use Psl\IO component.
introduced a Psl\IO\pipe(): (Psl\IO\CloseReadHandleInterface, Psl\IO\CloseWriteHandleInterface) function to create a pair of handles, where writes to the WriteHandle can be read from the ReadHandle.
BC - $encoding argument for Psl\Str functions now accepts Psl\Str\Encoding instead of ?string.
introduced a new Psl\Runtime component.
introduced a new Psl\Network component.
introduced a new Psl\TCP component.
introduced a new Psl\Unix component.
introduced a new Psl\Channel component.
introduced a new IO\write() function.
introduced a new IO\write_line() function.
introduced a new IO\write_error() function.
introduced a new IO\write_error_line() functions.
introduced a new Psl\Html\Encoding enum.
BC - $encoding argument for Psl\Html functions now accepts Psl\Html\Encoding instead of ?string.
BC - Psl\Shell\escape_command function has been removed, no replacement is available.
introduced a new Psl\Math\acos function.
introduced a new Psl\Math\asin function.
introduced a new Psl\Math\atan function.
introduced a new Psl\Math\atan2 function.
BC - The type of the $numbers argument of Psl\Math\mean has changed to list<int|float> instead of iterable<int|float>.
BC - The type of the $numbers argument of Psl\Math\median has changed to list<int|float> instead of iterable<int|float>.
introduced a new Psl\Promise component.
BC - Psl\Result\ResultInterface now implements Psl\Promise\PromiseInterface
BC - Psl\Type\resource('curl')->toString() now uses PHP built-in resource kind notation ( i.e: resource (curl) ) instead of generic notation ( i.e: resource<curl> )
BC - Psl\Str, Psl\Str\Byte, and Psl\Str\Grapheme functions now throw Psl\Str\Exception\OutOfBoundsException instead of Psl\Exception\InvaraintViolationsException when $offset is out-of-bounds.
BC - Psl\Collection\IndexAccessInterface::at() now throw Psl\Collection\Exception\OutOfBoundsException instead of Psl\Exception\InvariantViolationException if $k is out-of-bounds.
BC - Psl\Collection\AccessibleCollectionInterface::slice signature has changed from slice(int $start, int $length): static to slice(int $start, ?int $length = null): static
BC - All psl functions previously accepting callable, now accept only Closure.
BC - Psl\DataStructure\QueueInterface::dequeue, and Psl\DataStructure\StackInterface::pop now throw Psl\DataStructure\Exception\UnderflowException instead of Psl\Exception\InvariantViolationException when the data structure is empty.
BC - Psl\Filesystem\write_file($file, $content) function has been removed, use Psl\File\write($file, $content); instead.
To preserve the same behavior as the old function, use
Psl\File\write($file, $content, Filesystem\is_file($file) ? File\WriteMode::TRUNCATE : File\WriteMode::OPEN_OR_CREATE).
BC - Psl\Filesystem\read_file($file, $offset, $length) function has been removed, use Psl\File\read($file, $offset, $length) instead.
BC - Psl\Filesystem\append_file($file, $contents) function has been removed, use Psl\File\write($file, $contents, File\WriteMode::APPEND) instead.
BC - Psl\Filesystem functions no longer throw Psl\Exception\InvariantViolationException.
New exceptions:
Psl\Filesystem\Exception\NotReadableException thrown when attempting to read from a non-readable nodePsl\Filesystem\Exception\NotFileException thrown when attempting a file operation on a non-file node.Psl\Filesystem\Exception\NotDirectoryException thrown when attempting a directory operation on a non-directory node.Psl\Filesystem\Exception\NotSymbolicLinkException thrown when attempting a symbolic link operation on a non-symbolic link node.Psl\Filesystem\Exception\NotFoundException thrown when attempting an operation on a non-existing node.introduced Psl\Hash\Algorithm enum.
introduced Psl\Hash\Hmac\Algorithm enum.
BC - Psl\Hash\hash, and Psl\Hash\Context::forAlgorithm now take Psl\Hash\Algorithm as an algorithm, rather than a string.
BC - Psl\Hash\Hmac\hash, and Psl\Hash\Context::hmac now take Psl\Hash\Hmac\Algorithm as an algorithm, rather than a string.
BC - A new method chunk(positive-int $size): CollectionInterface has been added to Psl\Collection\CollectionInterface.
introduced a new Psl\OS component.
introduced Psl\Password\Algorithm enum
BC - all constants of Psl\Password component has been removed.
BC - function Psl\Password\algorithms() have been removed.
BC - Psl\Result\ResultInterface::getException() method has been renamed to Psl\Result\ResultInterface::getThrowable()
BC - Psl\Result\wrap function now catches all Throwables instead of only Exceptions
introduced a new Psl\Result\reflect function
BC - Psl\Shell\escape_argument function has been removed, Shell\execute arguments are now always escaped.
BC - $escape_arguments argument of Shell\execute function has been removed.
introduced a new Psl\Shell\ErrorOutputBehavior enum
added a new $error_output_behavior argument to Shell\execute function, which can be used to return the command error output content, as well as the standard output content.
introduced a new Psl\Shell\unpack function to unpack packed result of Shell\execute ( see Psl\Shell\ErrorOutputBehavior::Packed ).
introduced a new Psl\Shell\stream_unpack function to unpack packed result of Shell\execute chunk by chunk, maintaing order ( see Psl\Shell\ErrorOutputBehavior::Packed ).
How can I help you explore Laravel packages today?