Download the PHP package chr15k/array without Composer
On this page you can find all versions of the php package chr15k/array. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package array
Awesome Array helpers for your PHP project
This package provides useful helpers for working with arrays in PHP.
Based on ...
- Laravel's array helper work (https://github.com/laravel/framework)
Install
You can install this package via composer:
Usage
- accessible
- add
- collapse
- crossJoin
- divide
- dot
- except
- exists
- first
- flatten
- forget
- get
- has
- hasAny
- isAssoc
- isMultiDimensional
- last
- only
- pluck
- prepend
- pull
- query
- random
- set
- shuffle
- sort
- sortRecursive
- where
- wrap
Arr::accessible()
The Arr::accessible method checks that the given value is array accessible:
Arr::add()
The Arr::add method adds a given key / value pair to an array if the given key doesn't already exist in the array or is set to null:
Arr::collapse()
The Arr::collapse method collapses an array of arrays into a single array:
Arr::crossJoin()
The Arr::crossJoin method cross joins the given arrays, returning a Cartesian product with all possible permutations:
Arr::divide()
The Arr::divide method returns two arrays, one containing the keys, and the other containing the values of the given array:
Arr::dot()
The Arr::dot method flattens a multi-dimensional array into a single level array that uses "dot" notation to indicate depth:
Arr::except()
The Arr::except method removes the given key / value pairs from an array:
Arr::exists()
The Arr::exists method checks that the given key exists in the provided array:
Arr::first()
The Arr::first method returns the first element of an array passing a given truth test:
Arr::flatten()
The Arr::flatten method flattens a multi-dimensional array into a single level array:
Arr::forget()
The Arr::forget method removes a given key / value pair from a deeply nested array using "dot" notation:
Arr::get()
The Arr::get method retrieves a value from a deeply nested array using "dot" notation:
Arr::has()
The Arr::has method checks whether a given item or items exists in an array using "dot" notation:
Arr::hasAny()
The Arr::hasAny method checks whether any item in a given set exists in an array using "dot" notation:
Arr::isAssoc()
The Arr::isAssoc returns true if the given array is an associative array. An array is considered "associative" if it doesn't have sequential numerical keys beginning with zero:
Arr::isMultiDimensional()
The Arr::isMultiDimensional method returns true if the given array is multi-dimensional
Arr::last()
The Arr::last method returns the last element of an array passing a given truth test:
Arr::only()
The Arr::only method returns only the specified key / value pairs from the given array:
Arr::pluck()
The Arr::pluck method retrieves all of the values for a given key from an array:
Arr::prepend()
The Arr::prepend method will push an item onto the beginning of an array:
Arr::pull()
The Arr::pull method returns and removes a key / value pair from an array:
Arr::query()
The Arr::query method converts the array into a query string:
Arr::random()
The Arr::random method returns a random value from an array:
Arr::set()
The Arr::set method sets a value within a deeply nested array using "dot" notation:
Arr::shuffle()
The Arr::shuffle method randomly shuffles the items in the array:
Arr::sort()
The Arr::sort method sorts an array by its values.
Arr::sortRecursive()
The Arr::sortRecursive method recursively sorts an array using the sort function for numeric sub=arrays and ksort for associative subarrays:
Arr::where()
The Arr::where method filters an array using the given Closure:
Arr::wrap()
The Arr::wrap method wraps the given value in an array. If the given value is already an array it will not be changed:
Testing
You can run the tests with:
License
The MIT License (MIT). Please see License File for more information.