chain
chain copied to clipboard
Chain provides you with a consistent and chainable way to work with arrays in PHP.
It would be good if generics are added, for better static analysis. For example, the find method should return `T|false`. Reference: https://phpstan.org/blog/generics-in-php-using-phpdocs
`map()`s callable receives two arguments, the value and its index. This makes using standard library functions like `trim` and `intval` problematic without wrapping them in an anonymous or arrow function...
This should be a bit more efficient than the internal array_merge. It is using references in order to improve speed when using large arrays. It also does not modify passed...
I have a scenario where i need to merge multiple domain value objects and it would be handy if one could just do: ```php Chain::merge($object->getOutsidePhotos(), $object->getInsidePhotos()) ->map(fn (Photo $photo) =>...
I made a matrix comparing JS array API, PHP anc Chain. I've matched the methods when possible. I haven't dig into JS objects API, nor lodash or reactivex yet. |...
PHP 8.1 requires the offsetGet function to be compatible with the ArrayAccess declaration, i.e. to have a mixed return type. Without this, the Chain library produces deprecation notices like this:...