NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #1359 most downloaded on Packagist
PHP Standard Library
Latest stable
6.4.2
Last release 25 days ago
28 Oct 2026
Release timing varies
gaps range from 8 days to 7 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
78 releases · first in 2020
Drag across the ruler to compare, or tap a release to open it.
Nothing published for this version
[Regex] Introduced capture_groups, every_match, first_match functions (#151 - thanks @veewee )
Features:
Class componentInterface componentTrait componentOther:
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Backport static analysis fixes to 1.6 by @veewee in https://github.com/azjezz/psl/pull/337
Full Changelog: https://github.com/azjezz/psl/compare/1.6.2...1.6.3
chore(php): fix PHP 8.1 deprecations by @azjezz in https://github.com/azjezz/psl/pull/304
Full Changelog: https://github.com/azjezz/psl/compare/1.6.1...1.6.2
Nothing published for this version
added Psl\Type\positive_int function ( @michaelpetri - #177 )
Features:
Psl\Type\positive_int function ( @michaelpetri - #177 )Psl\Dict\unique_scalar function ( @pencil-dog and @yivi - #168 )Psl\Str\Byte\reverse implementation ( @ntzm - #160 )BC breaks:
Psl\Str\metaphone from ?string to string ( @ntzm - #159 )Psl\Str\metaphone now throws Psl\Exception\InvariantViolationException if $phonemes is negative ( @ntzm - #159 )non-empty-string instead of string when applicable ( @ntzm - #162 )Introduced Filesystem component
Components:
Features:
Psl\Shell\execute functionPsl\Shell\escape_argument functionPsl\Shell\escape_command functionPsl\Filesystem\SEPARATOR constantPsl\Filesystem\change_group functionPsl\Filesystem\change_owner functionPsl\Filesystem\change_permissions functionPsl\Filesystem\copy functionPsl\Filesystem\create_directory functionPsl\Filesystem\create_file functionPsl\Filesystem\delete_directory functionPsl\Filesystem\delete_file functionPsl\Filesystem\exists functionPsl\Filesystem\file_size functionPsl\Filesystem\get_group functionPsl\Filesystem\get_owner functionPsl\Filesystem\get_permissions functionPsl\Filesystem\get_basename functionPsl\Filesystem\get_directory functionPsl\Filesystem\get_extension functionPsl\Filesystem\get_filename functionPsl\Filesystem\is_directory functionPsl\Filesystem\is_file functionPsl\Filesystem\is_symbolic_link functionPsl\Filesystem\is_readable functionPsl\Filesystem\is_writable functionPsl\Filesystem\canonicalize functionPsl\Filesystem\is_executable functionPsl\Filesystem\read_directory functionPsl\Filesystem\read_file functionPsl\Filesystem\read_symbolic_link functionPsl\Filesystem\append_file functionPsl\Filesystem\write_file functionPsl\Filesystem\create_temporary_file functionPsl\Filesystem\create_hard_link functionPsl\Filesystem\create_symbolic_link functionPsl\Filesystem\get_access_time functionPsl\Filesystem\get_change_time functionPsl\Filesystem\get_modification_time functionPsl\Filesystem\get_inode functionPsl\Regex\replace_by function.?int $limit = null parameter to Psl\Regex\replace?int $limit = null parameter to Psl\Regex\replace_everyPsl\Html\encode functionPsl\Html\encode_special_characters functionPsl\Html\decode functionPsl\Html\decode_special_characters functionPsl\Html\strip_tags functionPsl\Type\literal_scalar functionPsl\Type\optional functionPsl\Type\TypeInterface::isOptional methodPsl\IO\input_handle functionPsl\IO\output_handle functionPsl\IO\error_handle functionPsl\IO\CloseHandleInterface interfacePsl\IO\CloseReadHandleInterface interfacePsl\IO\CloseReadWriteHandleInterface interfacePsl\IO\CloseSeekHandleInterface interfacePsl\IO\CloseSeekReadHandleInterface interfacePsl\IO\CloseSeekReadWriteHandleInterface interfacePsl\IO\CloseSeekWriteHandleInterface interfacePsl\IO\CloseWriteHandleInterface interfacePsl\IO\HandleInterface interfacePsl\IO\ReadHandleInterface interfacePsl\IO\ReadWriteHandleInterface interfacePsl\IO\SeekHandleInterface interfacePsl\IO\SeekReadHandleInterface interfacePsl\IO\SeekReadWriteHandleInterface interfacePsl\IO\SeekWriteHandleInterface interfacePsl\IO\WriteHandleInterface interfacePsl\IO\Writer classPsl\IO\Reader classPsl\IO\MemoryHandle classPsl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )
Fixes:
Psl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )deprecated Psl\Iter\diff_by_key ( use Psl\Dict\diff_by_key instead )
Features:
Psl\Regex\matches functionPsl\Regex\replace functionPsl\Regex\replace_every functionPsl\Regex\split functionPsl\Vec\filter functionPsl\Vec\filter_keys functionPsl\Vec\filter_with_key functionPsl\Vec\map functionPsl\Vec\map_with_key functionPsl\Dict\filter_nullsPsl\Dict\diff functionPsl\Dict\diff_by_key functionPsl\Dict\intersect functionPsl\Dict\intersect_by_key functionDeprecation:
Psl\Iter\diff_by_key ( use Psl\Dict\diff_by_key instead )Psl\Iter\chain ( use Psl\Vec\concat instead )Psl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )
Fixes:
Psl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )all Type\is_* functions have been deprecated, use Type\string()->matches($value) instead of Type\is_string($value)
Features:
Type\vec functions that returns a Type of vec<T> ( aka list<T>, T[] )Type\dict function that returns a Type of dict<Tk, Tv> ( aka array<Tk, Tv> )Type\TypeInterface interface that is implemented by all types.Type::matches($value): bool method to check if the given value is of that type.Deprecation:
Type\is_* functions have been deprecated, use Type\string()->matches($value) instead of Type\is_string($value)Breaking changes:
matches has been added to Type\Type, if you have a type that extends this base class, you probably won't be effected, unless you have a method in your class named matches.Arr component has been deprecated in favor of Iter, Vec, and Dict.
This release brings 3 new components to PSL, Vec, Dict, and Encoding.
Arr component has been deprecated in favor of Iter, Vec, and Dict.
We also introduced a new type function Type\shape() to support object-like-arrays.
Example:
try {
$input = Type\shape([
'name' => Type\string(),
'email' => Type\string(),
'address' => Type\shape([
'country' => Type\string(),
'state' => Type\string(),
'city' => Type\string(),
]),
])->assert($_POST);
} catch (Type\Exception\AssertException) {
// bad request!
}
However, it is not possible to explain the return type for this function to static analysis tools such as psalm, so we have added a psalm plugin that would make your experience using PSL better.
To enable the new Psalm Plugin, follow the instructions in the README.
In the example above, if you don't have the plugin enabled, the return type inferred by psalm for assert($_POST) would be array<string, array<string, string>|string>, which is correct, but can be more specific, with the help of the newly added plugin, psalm will understand that the return type is actually array{name: string, email: string, address: array{country: string, state: string, city: string}}, which helps you avoid issues such as accessing an out-of-bound index.
Features:
Psl\Integration\Psalm\Plugin ( psalm-plugin )Psl\Type\shapePsl\Vec\chunkPsl\Vec\chunk_with_keysPsl\Vec\concatPsl\Vec\enumeratePsl\Vec\fillPsl\Vec\filter_nullsPsl\Vec\flat_mapPsl\Vec\keysPsl\Vec\valuesPsl\Vec\partitionPsl\Vec\rangePsl\Vec\reductionsPsl\Vec\reproducePsl\Vec\reversePsl\Vec\shufflePsl\Vec\sortPsl\Vec\sort_byPsl\Vec\valuesPsl\Vec\zipPsl\Dict\associatePsl\Dict\dropPsl\Dict\drop_whilePsl\Dict\equalPsl\Dict\filterPsl\Dict\filter_keysPsl\Dict\filter_with_keyPsl\Dict\flattenPsl\Dict\flipPsl\Dict\from_entriesPsl\Dict\from_iterablePsl\Dict\from_keysPsl\Dict\group_byPsl\Dict\mapPsl\Dict\map_keysPsl\Dict\map_with_keyPsl\Dict\mergePsl\Dict\partitionPsl\Dict\partition_with_keyPsl\Dict\pullPsl\Dict\pull_with_keyPsl\Dict\reindexPsl\Dict\select_keysPsl\Dict\slicePsl\Dict\sortPsl\Dict\sort_byPsl\Dict\sort_by_keyPsl\Dict\takePsl\Dict\take_whilePsl\Dict\uniquePsl\Dict\unique_byPsl\Encoding\Base64\encodePsl\Encoding\Base64\decodePsl\Encoding\Hex\encodePsl\Encoding\Hex\decodeDeprecation:
Psl\Iter\to_array ( use Psl\Vec\values instead )Psl\Iter\values ( use Psl\Vec\values instead )Psl\Arr\concat ( use Psl\Vec\concat instead )Psl\Arr\count ( use Psl\Iter\count instead )Psl\Arr\filter_nulls ( use Psl\Vec\filter_nulls instead )Psl\Arr\flat_map ( use Psl\Vec\flat_map instead )Psl\Arr\keys ( use Psl\Vec\keys instead )Psl\Arr\shuffle ( use Psl\Vec\shuffle instead )Psl\Arr\sort ( use Psl\Vec\sort instead )Psl\Arr\sort_by ( use Psl\Vec\sort_by instead )Psl\Arr\values ( use Psl\Vec\values instead )Psl\Iter\chunk ( use Psl\Vec\chunk instead )Psl\Iter\chunk_with_keys ( use Psl\Vec\chunk_with_keys instead )Psl\Iter\filter_nulls ( use Psl\Vec\filter_nulls instead )Psl\Iter\flat_map ( use Psl\Vec\flat_map instead )Psl\Iter\keys ( use Psl\Vec\keys instead )Psl\Iter\range ( use Psl\Vec\range instead )Psl\Iter\reductions ( use Psl\Vec\reductions instead )Psl\Iter\repeat ( use Psl\Vec\fill instead )Psl\Iter\reproduce ( use Psl\Vec\reproduce instead )Psl\Iter\reverse ( use Psl\Vec\reverse instead )Psl\Iter\zip ( use Psl\Vec\zip instead )Psl\Arr\drop ( use Psl\Dict\drop instead )Psl\Arr\drop_while ( use Psl\Dict\drop_while instead )Psl\Arr\equal ( use Psl\Dict\equal instead )Psl\Arr\filter ( use Psl\Dict\filter instead )Psl\Arr\filter_with_key ( use Psl\Dict\filter_with_key instead )Psl\Arr\filter_keys ( use Psl\Dict\filter_keys instead )Psl\Arr\flatten ( use Psl\Dict\flatten instead )Psl\Arr\flip ( use Psl\Dict\flip instead )Psl\Arr\group_by ( use Psl\Dict\group_by instead )Psl\Arr\map ( use Psl\Dict\map instead )Psl\Arr\map_with_key ( use Psl\Dict\map_with_key instead )Psl\Arr\map_keys ( use Psl\Dict\map_keys instead )Psl\Arr\merge ( use Psl\Dict\merge instead )Psl\Arr\partition ( use Psl\Dict\partition instead )Psl\Arr\select_keys ( use Psl\Dict\select_keys instead )Psl\Arr\slice ( use Psl\Dict\slice instead )Psl\Arr\sort_by_key ( use Psl\Dict\sort_by_key instead )Psl\Arr\sort_with_keys ( use Psl\Dict\sort_with_keys instead )Psl\Arr\sort_with_keys_by ( use Psl\Dict\sort_with_keys_by instead )Psl\Arr\take ( use Psl\Dict\take instead )Psl\Arr\take_while ( use Psl\Dict\take_while instead )Psl\Arr\unique ( use Psl\Dict\unique instead )Psl\Arr\unique_by ( use Psl\Dict\unique_by instead )Psl\Iter\drop ( use Psl\Dict\drop instead )Psl\Iter\drop_while ( use Psl\Dict\drop_while instead )Psl\Iter\slice ( use Psl\Dict\slice instead )Psl\Iter\take ( use Psl\Dict\take instead )Psl\Iter\take_while ( use Psl\Dict\take_while instead )Psl\Iter\reindex ( use Psl\Dict\reindex instead )Psl\Iter\pull ( use Psl\Dict\pull instead )Psl\Iter\pull_with_key ( use Psl\Dict\pull_with_key instead )Psl\Iter\to_array_with_keys ( use Psl\Dict\from_iterable instead )Psl\Iter\map ( use Psl\Dict\map instead )Psl\Iter\map_with_key ( use Psl\Dict\map_with_key instead )Psl\Iter\map_keys ( use Psl\Dict\map_keys instead )Psl\Iter\from_entries ( use Psl\Dict\from_entries instead )Psl\Iter\from_keys ( use Psl\Dict\from_keys instead )Psl\Iter\product ( no replacement provided )Psl\Iter\filter ( use Psl\Dict\filter instead )Psl\Iter\filter_with_key ( use Psl\Dict\filter_with_key instead )Psl\Iter\filter_keys ( use Psl\Dict\filter_keys instead )Psl\Iter\flip ( use Psl\Dict\flip instead )Psl\Iter\flatten ( use Psl\Dict\flatten instead )Psl\Iter\merge ( use Psl\Dict\merge instead )Psl\Arr\contains ( use Psl\Iter\contains instead )Psl\Arr\contains_key ( use Psl\Iter\contains_key instead )Psl\Arr\count ( use Psl\Iter\count instead )Psl\Arr\count_values ( use Psl\Dict\count_values instead )Psl\Arr\first ( use Psl\Iter\first instead )Psl\Arr\firstx ( use Psl\Iter\first instead )Psl\Arr\first_key ( use Psl\Iter\first_key instead )Psl\Arr\last ( use Psl\Iter\last instead )Psl\Arr\lastx ( use Psl\Iter\last instead )Psl\Arr\last_key ( use Psl\Iter\last_key instead )Psl\Arr\idx ( use $array|$key] ?? $default instead )Psl\Arr\at ( use $array[$key] instead )Psl\Iter\enumerate ( use Psl\Vec\enumerate instead )[Type] fix parameters name in union function #117
Bug fixes:
[Type]: added new Type\non_empty_string function - #116
Features:
Type\non_empty_string function - #116Iter\flat_map function - #112 ( thanks to @veewee )Arr\flat_map function - #112 ( thanks to @veewee )Math\clamp function - #111 ( thanks to @veewee )Bug Fixes:
Nothing published for this version
add .github folder to export-ignore
.github folder to export-ignoreadded Str\after{_ci|_last{_ci}} and Str\before{_ci|_last{_ci}} helper string functions.
Str\after{_ci|_last{_ci}} and Str\before{_ci|_last{_ci}} helper string functions.Str\Byte\after{_ci|_last{_ci}} and Str\Byte\before{_ci|_last{_ci}} helper string functions.Str\Grapheme\after{_ci|_last{_ci}} and Str\Grapheme\before{_ci|_last{_ci}} helper string functions.Str\Byte\search_last_ci functionStr\Byte\search_last returns an empty string for an empty needle ( now returns null )This is the first release of PSL, a modern, consistent, centralized, well-typed set of APIs for PHP programmers.
This is the first release of PSL, a modern, consistent, centralized, well-typed set of APIs for PHP programmers.
One column per quarter.