Download the PHP package laxity7/yii2-collection without Composer
On this page you can find all versions of the php package laxity7/yii2-collection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laxity7/yii2-collection
More information about laxity7/yii2-collection
Files in laxity7/yii2-collection
Package yii2-collection
Short Description Active Record Collection implementation for the Yii framework
License BSD-3-Clause
Informations about the package yii2-collection
ActiveRecord Collection Extension for Yii 2
This extension provides a generic data collection as well as a collection for the ActiveRecord DB layer of Yii 2.
Development is currently in experimental state. It is not ready for production use and may change significantly.
For license information check the LICENSE-file.
Documentation is at docs/guide/README.md.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json.
Basic usage
Collection is a container for a set of items.
It provides methods for transforming and filtering the items as well as sorting methods, which can be applied using a chained interface. All these operations will return a new collection containing the modified data keeping the original collection as it was as long as containing objects state is not changed.
The collection implements [[ArrayAccess]], [[Iterator]], and [[Countable]], so you can access it in the same way you use a PHP array. A collection however is read-only, you can not manipulate single items.
Configuration for ActiveRecord
To use this extension, you have to attach the yii\collection\CollectionBehavior
to the ActiveQuery
instance of
your ActiveRecord
classes by overriding the find()
method: