ducatel / php-collection
Implementation of data structure in PHP
dev-master / 1.0.x-dev
2016-08-23 19:56 UTC
Requires
- php: ~7.0
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2024-10-10 02:27:43 UTC
README
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)
Install
Via Composer
$ composer require ducatel/php-collection
Usage
$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
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email david@ducatel.eu instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.