Download the PHP package vectorial1024/alof-lib without Composer
On this page you can find all versions of the php package vectorial1024/alof-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vectorial1024/alof-lib
More information about vectorial1024/alof-lib
Files in vectorial1024/alof-lib
Package alof-lib
Short Description PHP array-like object functions library.
License MIT
Informations about the package alof-lib
alof-lib
(This is a WIP project!)
PHP array-like object functions library ("alof-lib"). Type-hinted functions for array-like objects, just like those for native arrays. Think of this library as a polyfill of those useful functions for array-like objects, so that you may write clean code with array-like objects.
An array-like object ("ALO") is defined to be implements ArrayAccess
and implements Traversable
. Examples include:
- ArrayObject (since PHP 5)
- ArrayIterator (since PHP 5)
- SplObjectStorage (since PHP 5.1)
- SplDoublyLinkedList (since PHP 5.3)
- SplFixedArray (since PHP 5.3)
- SplStack (since PHP 5.3)
- SplQueue (since PHP 5.3)
- WeakMap (since PHP 8)
- ... and perhaps more
A PHP array
is NOT an ALO. It is still an array.
Latest version requires PHP 8.1+.
See the change log in the CHANGELOG.md
file.
Want to easily process ALOs? See vectorial1024/transmutation
here.
Notes and Disclaimers
- ALO functions aim to be faithful user-land reproductions of their array function counterparts, but there might be slight differences between both sides
- Some ALO functions may not make sense depending on your exact ALO implementation; use judgement before you use the ALO functions
Installation
via Composer:
Testing
This library uses PHPUnit for testing, which can be triggered from Composer. To test this library, run:
Example Usage
Refer to the test cases under /tests
for more examples, but for a minimal example:
Relationship with transmutation
This library does the dirty work and ensures the correctness of ALO functions, while transmutation
provides an easy-to-use API for ALO processing.