PHPackages                             salient/collections - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. salient/collections

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

salient/collections
===================

The collections component of the Salient toolkit

v0.99.81(1y ago)097.8k↓59.5%3MITPHPPHP &gt;=7.4

Since Jul 20Pushed 7mo agoCompare

[ Source](https://github.com/salient-labs/toolkit-collections)[ Packagist](https://packagist.org/packages/salient/collections)[ RSS](/packages/salient-collections/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (2)Versions (51)Used By (3)

salient/collections
===================

[](#salientcollections)

> The collections component of the [Salient toolkit](https://github.com/salient-labs/toolkit)

 [![Latest Stable Version](https://camo.githubusercontent.com/b978c1049c392d826a98e1793e98d0cfc71599bbd0d2ce65c09d161b8d1f70c0/68747470733a2f2f706f7365722e707567782e6f72672f73616c69656e742f746f6f6c6b69742f76)](https://packagist.org/packages/salient/toolkit) [![License](https://camo.githubusercontent.com/a69dc21b66521958734e54526bc047b3502cfcec0f337643a14479da7c36506d/68747470733a2f2f706f7365722e707567782e6f72672f73616c69656e742f746f6f6c6b69742f6c6963656e7365)](https://packagist.org/packages/salient/toolkit) [![CI Status](https://github.com/salient-labs/toolkit/actions/workflows/ci.yml/badge.svg)](https://github.com/salient-labs/toolkit/actions) [![Code Coverage](https://camo.githubusercontent.com/9cd7526674c8d5a9d2c8f9150467975632309756513e52ece90427cd2ca97203/68747470733a2f2f636f6465636f762e696f2f67682f73616c69656e742d6c6162732f746f6f6c6b69742f67726170682f62616467652e7376673f746f6b656e3d59306c395a6545747249)](https://codecov.io/gh/salient-labs/toolkit)

---

`salient/collections` provides classes and traits that allow collections of values to be accessed via array-like objects with chainable methods.

- Collections are immutable except when array syntax is used to set or unset items
- Use `Collection` or `ListCollection` with values of any type, or extend them to add type-specific behaviour
- Remix `CollectionTrait`, `ListCollectionTrait`, `ReadOnlyCollectionTrait` and `ReadOnlyArrayAccessTrait` for custom behaviour, e.g. to create a strictly immutable collection class

```
