Download the PHP package eclipxe/generic-collections without Composer
On this page you can find all versions of the php package eclipxe/generic-collections. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eclipxe/generic-collections
More information about eclipxe/generic-collections
Files in eclipxe/generic-collections
Package generic-collections
Short Description Library to mimics generic collections
License MIT
Homepage https://github.com/eclipxe13/generic-collections
Informations about the package generic-collections
eclipxe/generic-collections
Generic Collections PHP Library is a PHP 5.6+ that mimics the Java Collections Framework.
As PHP does not have Generics this library will always implements type checks.
Don't worry, anyways you can always use the mixed
type
For concrete classes uses a constructor approach:
For your own classes you could extend the abstract class and implement the appropiated type methods, by example:
Installation
The preferred method of installation is via Packagist and Composer. Run
the following command to install the package and add it as a requirement to
your project's composer.json
:
List of classes
Basic classes:
- [x] Collection: A collection represents a group of elements of the same type.
- [x] Set: A collection that only allows unique elements
- [x] Queue: Collection for holding elements (FIFO)
- [x] Deque: Double Ended Queue
Classes that implement \ArrayAccess
- [x] Map: A mapping from keys to values.
- [ ] List: A collection that can be accessed by their integer index and search elements on the list.
Additional classes:
- [x] Stack: Collection for holding elements (LIFO)
- [x]
ShapeTypedStruct: Structure with typed values (also with\ArrayAccess
)
All classes have these additional options:
- allow null elements/values
- allow only unique elements/values
- comparison equal (make equality comparisons between members instead of identical comparisons)
About
This library is inspired by the Java Collections Framework and PHP ramsey/collection library.
I see significant changes with ramsey's package, as I didn't want to introduce heavy changes to his API I decide to create my own approach.
I had also take a deep search on Packagist but couldn't find a library that ensure type checking on members.
Yes, my mistake, the repository username is eclipxe13/
and the packagist name is eclipxe/
.
Compatibility
This class will be compatible according to PHP Supported versions, Security Support. This means that it will offer compatibility with PHP 5.6+ until 2018-12-31.
The support for version 5.5+ is not included since this PHP version will end 2016-06-10 and that is lower than the release of first version of this library.
Not taking particular efforts to make this library compatible with hhvm, hhvm have Generics support included
and also has a collection library. I have seen differences on how hack language implement traits (like the
ability to use abstracts methods) that are not compatible. Also I've seen a problem on hhvm 3.6.6
(the one is using Travis CI)implementation of SplDoubleLinkedList
that are not present on version 3.12.1.
Documentation and examples
WIP. Be patient please.
Contributing
Contributions are welcome! Please read CONTRIBUTING for details and don't forget to take a look in the TODO and CHANGELOG files.
Copyright and License
The eclipxe/generic-collections library is copyright © Carlos C Soto and licensed for use under the MIT License (MIT). Please see LICENSE for more information.