This library adds some "standard" collections for PHP. Collections are like array which follow constrains :
- Typed collections which accept only one type of variable
- Sorted collections which are always sorted
- Set collections which not allows duplicates
- Array collections which allows duplicates
You can found also some already specialized collection for non object variable (like string or number)
Via Composer
$ composer require ducatel/php-collection
$stringArray = new Ducatel\PHPCollection\Specialized\StringArray();
$stringArray[] = "a"; // ['a']
$stringArray[] = "b"; // ['a', 'b']
$stringArray[] = new PDO(); // FAIL
$typedArray = new Ducatel\PHPCollection\TypedArray(MyClass::class);
$typedArray[] = new MyClass(); // OK
$typedArray[] = "a"; // FAIL
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.