Properties

$macros

$macros : array

The registered string macros.

Type

array

Methods

macro()

macro(string  $name, object|callable  $macro) : void

Register a custom macro.

Parameters

string $name
object|callable $macro

mixin()

mixin(object  $mixin) : void

Mix another object into the class.

Parameters

object $mixin

Throws

\ReflectionException

hasMacro()

hasMacro(string  $name) : boolean

Checks if macro is registered.

Parameters

string $name

Returns

boolean

__callStatic()

__callStatic(string  $method, array  $parameters) : mixed

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Throws

\BadMethodCallException

Returns

mixed

__call()

__call(string  $method, array  $parameters) : mixed

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Throws

\BadMethodCallException

Returns

mixed

accessible()

accessible(mixed  $value) : boolean

Determine whether the given value is array accessible.

Parameters

mixed $value

Returns

boolean

add()

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

Add an element to an array using "dot" notation if it doesn't exist.

Parameters

array $array
string $key
mixed $value

Returns

array

collapse()

collapse(array  $array) : array

Collapse an array of arrays into a single array.

Parameters

array $array

Returns

array

crossJoin()

crossJoin(array  ...$arrays) : array

Cross join the given arrays, returning all possible permutations.

Parameters

array $arrays variadic

Returns

array

divide()

divide(array  $array) : array

Divide an array into two arrays. One with keys and the other with values.

Parameters

array $array

Returns

array

dot()

dot(array  $array, string  $prepend = '') : array

Flatten a multi-dimensional associative array with dots.

Parameters

array $array
string $prepend

Returns

array

except()

except(array  $array, array|string  $keys) : array

Get all of the given array except for a specified array of keys.

Parameters

array $array
array|string $keys

Returns

array

exists()

exists(\ArrayAccess|array  $array, string|integer  $key) : boolean

Determine if the given key exists in the provided array.

Parameters

\ArrayAccess|array $array
string|integer $key

Returns

boolean

first()

first(array  $array, callable|null  $callback = null, mixed  $default = null) : mixed

Return the first element in an array passing a given truth test.

Parameters

array $array
callable|null $callback
mixed $default

Returns

mixed

last()

last(array  $array, callable|null  $callback = null, mixed  $default = null) : mixed

Return the last element in an array passing a given truth test.

Parameters

array $array
callable|null $callback
mixed $default

Returns

mixed

value()

value(  $value) 

Parameters

$value

flatten()

flatten(array  $array, integer  $depth = INF) : array

Flatten a multi-dimensional array into a single level.

Parameters

array $array
integer $depth

Returns

array

forget()

forget(array  $array, array|string  $keys) : void

Remove one or many array items from a given array using "dot" notation.

Parameters

array $array
array|string $keys

get()

get(\ArrayAccess|array  $array, string  $key, mixed  $default = null) : mixed

Get an item from an array using "dot" notation.

Parameters

\ArrayAccess|array $array
string $key
mixed $default

Returns

mixed

has()

has(\ArrayAccess|array  $array, string|array  $keys) : boolean

Check if an item or items exist in an array using "dot" notation.

Parameters

\ArrayAccess|array $array
string|array $keys

Returns

boolean

isAssoc()

isAssoc(array  $array) : boolean

Determines if an array is associative.

An array is "associative" if it doesn't have sequential numerical keys beginning with zero.

Parameters

array $array

Returns

boolean

only()

only(array  $array, array|string  $keys) : array

Get a subset of the items from the given array.

Parameters

array $array
array|string $keys

Returns

array

data_get()

data_get(mixed  $target, string|array  $key, mixed  $default = null) : mixed

Get an item from an array or object using "dot" notation.

Parameters

mixed $target
string|array $key
mixed $default

Returns

mixed

pluck()

pluck(array  $array, string|array  $value, string|array|null  $key = null) : array

Pluck an array of values from an array.

Parameters

array $array
string|array $value
string|array|null $key

Returns

array

prepend()

prepend(array  $array, mixed  $value, mixed  $key = null) : array

Push an item onto the beginning of an array.

Parameters

array $array
mixed $value
mixed $key

Returns

array

pull()

pull(array  $array, string  $key, mixed  $default = null) : mixed

Get a value from the array, and remove it.

Parameters

array $array
string $key
mixed $default

Returns

mixed

random()

random(array  $array, integer|null  $number = null) : mixed

Get one or a specified number of random values from an array.

Parameters

array $array
integer|null $number

Throws

\InvalidArgumentException

Returns

mixed

set()

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

Set an array item to a given value using "dot" notation.

If no key is given to the method, the entire array will be replaced.

Parameters

array $array
string $key
mixed $value

Returns

array

shuffle()

shuffle(array  $array) : array

Shuffle the given array and return the result.

Parameters

array $array

Returns

array

sort()

sort(array  $array, callable|string|null  $callback = null) : array

Sort the array using the given callback or "dot" notation.

Parameters

array $array
callable|string|null $callback

Returns

array

sortRecursive()

sortRecursive(array  $array) : array

Recursively sort an array by keys and values.

Parameters

array $array

Returns

array

where()

where(array  $array, callable  $callback) : array

Filter the array using the given callback.

Parameters

array $array
callable $callback

Returns

array

wrap()

wrap(mixed  $value) : array

If the given value is not an array, wrap it in one.

Parameters

mixed $value

Returns

array

explodePluckParameters()

explodePluckParameters(string|array  $value, string|array|null  $key) : array

Explode the "value" and "key" arguments passed to "pluck".

Parameters

string|array $value
string|array|null $key

Returns

array