Download the PHP package bolt/collection without Composer
On this page you can find all versions of the php package bolt/collection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bolt/collection
More information about bolt/collection
Files in bolt/collection
Package collection
Short Description Object Orientated implementations of various collections
License MIT
Informations about the package collection
Bolt Collection
This library provides objects and functionality to help with groups of items and data sets.
Check out the API documentation.
Bag
and MutableBag
These are object-oriented implementations of arrays.
The goal of these classes:
- Provide functionality on par with built-in array methods
- Provide useful functionality lacking from built-in array methods
- Provide a fluent-like experience
- Make implementing code more readable
Examples
These examples only cover half of the functionality. See the API documentation for more.
All methods accepting a collection will accept other Bags
, arrays
,
stdClass
, and Traversable
objects. This makes it very easy work with any
collection-like object.
Hasn't this been done already?
Obviously others think PHP arrays suck as well and have attempted to resolve this.
Symfony's ParameterBag
is a good basic map (associative arrays) container
but is lacking when it comes to mutating the items around and working with
lists.
Doctrine's ArrayCollection
is also another, more robust, option. It works
well for maps and lists, but still has limited functionality due to needing to
interface with a database collection. It also has some annoyances, like
getKeys()
returns an array
instead of another ArrayCollection
instance.
All versions of collection with dependencies
php Version ^5.5 || ^7.0
symfony/polyfill-php71 Version ^1.3
webmozart/assert Version ^1.0