Download the PHP package amber/collection without Composer

On this page you can find all versions of the php package amber/collection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package collection

GitHub last commit Latest Stable Version Latest Beta Version PHP from Packagist Build Status Coverage Status CodeFactor Total Downloads GitHub

Collection

Data structures as an alternative to the array.

Usage

With composer

In your code:

1) Instantiate an empty collection:

2) Instantiate a collection for an array:

3) Or use the static factory method make():

Available methods

has()

Whether an item is present it the collection.

has(string $key) : boolean

contains()

Alias for has.

contains(string $key) : boolean

hasNot()

Whether an item is not present it the collection.

hasNot(string $key) : boolean

set()

Sets or updates an item in the collection.

set(string $key, mixed $value) : void

put()

Alias for set.

put(string $key, mixed $value) : void

add()

Sets a new item to the collection.

add(string $key, mixed $value) : boolean

insert()

Alias for add.

insert(string $key, mixed $value) : boolean

update()

Updates an existent item in the collection.

update(string $key, mixed $value) : boolean

push()

Sets a new item at the end of the collection.

push(mixed $value) : void

pushTo()

Push a new item at the end of a item in the collection.

pushTo(string $key, mixed $value) : boolean

get()

Gets an item from collection.

get(string $key) : mixed|void

find()

Alias for get.

find(string $key) : mixed

first()

Returns the first element of the collection.

first() : mixed

last()

Returns the last element of the collection.

last() : mixed

remove()

Deletes and retrives an item from collection.

remove(string $key) : mixed

delete()

Deletes an item from collection.

delete(string $key) : boolean

map()

Iterates through the collection and passes each value to the given callback.

map(\Closure $callback) : \Amber\Collection\Base\Collection

filter()

Returns a new filtered collection using a user-defined function.

filter(\Closure $callback) : \Amber\Collection\Base\Collection

sort()

Returns a new sorted collection using a user-defined comparison function.

sort(\Closure $callback) : \Amber\Collection\Base\Collection

reverse()

Returns a new reversed collection.

reverse() : \Amber\Collection\Base\Collection

merge()

Returns a new collection merged with one or more arrays.

merge(array $array) : \Amber\Collection\Base\Collection

chunk()

Splits an array into chunks.

chunk(integer $size, boolean $preserve_keys = false) : \Amber\Collection\Base\Collection

column()

Returns the values from a single column.

column(string $column) : \Amber\Collection\Base\Collection

flip()

Exchanges all keys with their associated values.

flip() : \Amber\Collection\Base\Collection

setMultiple()

Sets or updates an array of items in the collection, and returns true on success.

setMultiple(array $array) : void

getMultiple()

Gets multiple items from the collection.

getMultiple(array $array) : mixed

hasMultiple()

Whether multiple items are present in the collection.

hasMultiple(array $array) : boolean

select()

Returns a new Collection containing the items in the specified column(s).

select(array|string $columns) : \Amber\Collection\Base\Collection

where()

Returns a new Collection containing the items in the specified column that are equal to the especified value.

where(string $column, mixed $value) : \Amber\Collection\Base\Collection

whereNot()

Returns a new Collection containing the items in the specified column that are not equal to the especified value.

whereNot(string $column, mixed $value) : \Amber\Collection\Base\Collection

whereIn()

Returns a new Collection containing the items in the specified column that are equal to the especified value(s).

whereIn(string $column, array $values = array()) : \Amber\Collection\Base\Collection

whereNotIn()

Returns a new Collection containing the items in the specified column that are not equal to the especified value(s).

whereNotIn(string $column, array $values = array()) : \Amber\Collection\Base\Collection

orderBy()

Returns a new Collection containing the items ordered by the especified column.

orderBy(string $column, string $order = 'ASC') : \Amber\Collection\Base\Collection

groupBy()

Returns a new Collection grouped by the specified column.

groupBy(string $column) : \Amber\Collection\Base\Collection

join()

Returns a new Collection joined by the specified column.

join(array $array, string $pkey, string $fkey) : \Amber\Collection\Base\Collection

sum()

Calculates the sum of values in the collection.

sum(string $column = null) : integer

Or you can sum a specific colum

firstOrNew()

Gets the first item of the Collection or adds and returns a new one.

firstOrNew(string $key, mixed $value) : mixed

updateOrNew()

Updates an item from the Collection or adds a new one.

updateOrNew(string $key, mixed $value) : mixed


All versions of collection with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amber/collection contains the following files

Loading the files please wait ....