co-stack / lib
A set of really useful, well tested and high performant php functions
Requires
- php: ^8.4
Requires (Dev)
- ergebnis/composer-normalize: ^2.47
- infection/infection: ^0.29.14
- jetbrains/phpstorm-attributes: ^1.2
- php-parallel-lint/php-parallel-lint: ^1.4
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.1
- rector/rector: ^2.0
- squizlabs/php_codesniffer: ^3.13
- dev-php84
- v8.2.0
- v8.1.0
- v8.0.0
- v7.3.0
- v7.2.0
- v7.1.0
- v7.0.0
- v6.5.0
- v6.4.0
- v6.3.0
- v6.2.0
- v6.1.0
- v6.0.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.0
- v5.0.0
- v4.6.0
- v4.5.0
- v4.4.0
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.0
- v3.5.0
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- dev-php81
- dev-php82
- dev-php83
- dev-php74
- dev-php80
- dev-php72
- dev-php73
This package is auto-updated.
Last update: 2025-06-28 01:23:13 UTC
README
(Only active branch badges are listed)
PHP 8.4
\
PHP 8.3
\
PHP 8.2
\
PHP 8.1
About
co-stack.com lib provides generic everyday functions, which aim to help you to focus on your main task. This package tries to achieve this by providing:
- intuitive function names
- high quality code
- constant performance optimization
- extensive documentation
- 100% test coverage
- dependency free code
- mostly pure functions
- namespaced functions
- Static Methods as OOP alternative
So you don't need to bother about performance or implementation details.
Classes list
This list does not include classes which are aliases/wrappers for functions.
\CoStack\Lib\Contract\Invokable
: An interface to force classes to implement__invoke
likeStringable
.\CoStack\Lib\Generic\Uri
: (Immutable) Basic URI implementation with methods to create variations.\CoStack\Lib\Pattern\MagicMethodsForImmutables
: A trait which implements__call
to make all propertiesget
-,with
- andwithout
-able.\CoStack\Lib\Pattern\Singleton
: The classic singleton pattern. Note that singletons must not have constructor arguments and you are not allowed to override__construct
.\CoStack\Lib\Utility\StringPool
: Reduces memory usage by interning strings. Refer topool
DocBlock.
Function list
array_filter_recursive
: Likearray_filter
, but recursively.array_value
: Get an array value by an index path.array_property
:array_column
for objectsarray_unique_keys
: Get an array of all distinct keys fo all arrays.concat_paths
: Concatenate filesystem paths without duplicate directory separators.mkdir_deep
:mkdir
with therecursive
flag, but withoutmode
.factory
: Creates a new object by mapping an associative array to constructor arguments and public properties.filter
: Factory for simple filter closures for use witharray_filter
.cgi_parse_str
: A pure and actually CGI compliant parse_str alternative.pool
: Alias for\CoStack\Lib\Utility\StringPool::get
.
Compatibility
There is one branch for each supported PHP version. Each branch has its own major version number. Only PHP versions, which are officially maintained are supported. Lower supported versions receive backports of all features, which are possible in that PHP Version. (e.g. type annotations will be backported, but Attributes will not be available below PHP 8.0)
Version | PHP Version | Branch Name | Maintained until | Currently Supported |
---|---|---|---|---|
1.x | 7.2 | php72 | 31 Jul 2021 | ❌ |
2.x | 7.3 | php73 | 6 Dec 2021 | ❌ |
3.x | 7.4 | php74 | 28 Nov 2022 | ❌ |
4.x | 8.0 | php80 | 26 Nov 2023 | ❌ |
5.x | 8.1 | php81 | 31 Dec 2025 | ✅ |
6.x | 8.2 | php82 | 31 Dec 2026 | ✅ |
7.x | 8.3 | php83 | 31 Dec 2027 | ✅ |
8.x | 8.4 | php84 | 31 Dec 2028 | ✅ |