Download the PHP package assegaiphp/collections without Composer
On this page you can find all versions of the php package assegaiphp/collections. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download assegaiphp/collections
More information about assegaiphp/collections
Files in assegaiphp/collections
Package collections
Short Description The assegaiphp/collections package is a powerful tool for creating and managing groups of related objects in your AssegaiPHP projects. With this library, you can easily organize and manipulate data in a variety of ways, such as arrays, lists, sets, and maps. The package offers a wide range of methods for adding, removing, and manipulating items, as well as sorting, searching, and filtering your collections. It is fully compatible with PHP 7.x and above and is designed to be lightweight and easy to use. Whether you're building a web application, a CLI tool, or a standalone script, assegaiphp/collections is the perfect choice for working with data. With its simple and intuitive interface, you can easily start working with collections in your project right away.
License MIT
Informations about the package collections
A progressive PHP framework for building effecient and scalable server-side applications.
AssegaiPHP Collections
A powerful and easy-to-use library for creating and managing collections of related objects in AssegaiPHP. This library provides a simple and intuitive interface for working with arrays of objects, making it easy to perform common operations such as filtering, mapping, and reducing.
Installation
You can install the library using composer by running the following command:
Usage
To create a new collection, you can use the Assegai\Collections\Collection
class. This class provides a simple and intuitive interface for working with arrays of objects, making it easy to perform common operations such as filtering, mapping, and reducing.
Here's an example of how to create a new collection and add some items to it:
Once you have a collection, you can use the various methods provided by the class to manipulate the items in the collection. For example, you can use the filter
method to filter the items in the collection based on a certain condition:
The map
method can be used to transform the items in the collection:
You can also use the reduce
method to reduce the collection to a single value:
API
The API of the Assegai\Collections\Collection
class is designed to be simple and intuitive. It provides the following methods:
add(mixed $item)
: Add an item to the collectionremove(mixed $item)
: Remove an item from the collectionfilter(callable $callback)
: Filter the items in collection based on a callback function.