Arr
class Arr (View source)
Traits
Properties
| static protected array | $macros | The registered string macros.  | 
                from Macroable | 
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Determine whether the given value is array accessible.
Determine whether the given value is arrayable.
Add an element to an array using "dot" notation if it doesn't exist.
Get an array item from an array using "dot" notation.
Get a boolean item from an array using "dot" notation.
Collapse an array of arrays into a single array.
Cross join the given arrays, returning all possible permutations.
Divide an array into two arrays. One with keys and the other with values.
Flatten a multi-dimensional associative array with dots.
Convert a flatten "dot" notation array into an expanded array.
Get all of the given array except for a specified array of keys.
Determine if the given key exists in the provided array.
No description
No description
Take the first or last {$limit} items from an array.
Flatten a multi-dimensional array into a single level.
Get a float item from an array using "dot" notation.
Remove one or many array items from a given array using "dot" notation.
No description
Get an item from an array using "dot" notation.
Check if an item or items exist in an array using "dot" notation.
Determine if all keys exist in an array using "dot" notation.
Determine if any of the keys exist in an array using "dot" notation.
Determine if all items pass the given truth test.
Determine if some items pass the given truth test.
Get an integer item from an array using "dot" notation.
Determines if an array is associative.
Determines if an array is a list.
Join all items using a string. The final items can use a separate glue string.
Key an associative array by a field or using a callback.
Prepend the key names of an associative array.
Get a subset of the items from the given array.
Select an array of values from an array.
Explode the "value" and "key" arguments passed to "pluck".
Run a map over each of the items in the array.
No description
No description
Push an item onto the beginning of an array.
Get a value from the array, and remove it.
Convert the array into a query string.
Get one or a specified number of random values from an array.
Set an array item to a given value using "dot" notation.
Push an item into an array using "dot" notation.
Shuffle the given array and return the result.
Get the first item in the array, but only if exactly one item exists. Otherwise, throw an exception.
Sort the array using the given callback or "dot" notation.
Sort the array in descending order using the given callback or "dot" notation.
Recursively sort an array by keys and values.
Recursively sort an array by keys and values in descending order.
Get a string item from an array using "dot" notation.
Conditionally compile classes from an array into a CSS class list.
Conditionally compile styles from an array into a style list.
Filter the array using the given callback.
Filter the array using the negation of the given callback.
No description
Filter items where the value is not null.
If the given value is not an array and not null, wrap it in one.
Details
        
                static            void
    macro(string $name, object|callable $macro)
        
    
    Register a custom macro.
        
                static            void
    mixin(object $mixin, bool $replace = true)
        
    
    Mix another object into the class.
        
                static            bool
    hasMacro(string $name)
        
    
    Checks if macro is registered.
        
                static            void
    flushMacros()
        
    
    Flush the existing macros.
        
                static            mixed
    __callStatic(string $method, array $parameters)
        
    
    Dynamically handle calls to the class.
        
                            mixed
    __call(string $method, array $parameters)
        
    
    Dynamically handle calls to the class.
        
                static            bool
    accessible(mixed $value)
        
    
    Determine whether the given value is array accessible.
        
                static            bool
    arrayable(mixed $value)
        
    
    Determine whether the given value is arrayable.
        
                static            array
    add(array $array, string|int|float $key, mixed $value)
        
    
    Add an element to an array using "dot" notation if it doesn't exist.
        
                static            array
    array(ArrayAccess|array $array, string|int|null $key, array|null $default = null)
        
    
    Get an array item from an array using "dot" notation.
        
                static            bool
    boolean(ArrayAccess|array $array, string|int|null $key, bool|null $default = null)
        
    
    Get a boolean item from an array using "dot" notation.
        
                static            array
    collapse(iterable $array)
        
    
    Collapse an array of arrays into a single array.
        
                static            array
    crossJoin(iterable ...$arrays)
        
    
    Cross join the given arrays, returning all possible permutations.
        
                static            array
    divide(array $array)
        
    
    Divide an array into two arrays. One with keys and the other with values.
        
                static            array
    dot(iterable $array, string $prepend = '')
        
    
    Flatten a multi-dimensional associative array with dots.
        
                static            array
    undot(iterable $array)
        
    
    Convert a flatten "dot" notation array into an expanded array.
        
                static            array
    except(array $array, array|string|int|float $keys)
        
    
    Get all of the given array except for a specified array of keys.
        
                static            bool
    exists(ArrayAccess|array $array, string|int|float $key)
        
    
    Determine if the given key exists in the provided array.
        
                static            
    first($array, callable|null $callback = null, $default = null)
        
    
    No description
        
                static            
    last($array, callable|null $callback = null, $default = null)
        
    
    No description
        
                static            array
    take(array $array, int $limit)
        
    
    Take the first or last {$limit} items from an array.
        
                static            array
    flatten(iterable $array, int $depth = INF)
        
    
    Flatten a multi-dimensional array into a single level.
        
                static            float
    float(ArrayAccess|array $array, string|int|null $key, float|null $default = null)
        
    
    Get a float item from an array using "dot" notation.
        
                static            void
    forget(array $array, array|string|int|float $keys)
        
    
    Remove one or many array items from a given array using "dot" notation.
        
                static            
    from($items)
        
    
    No description
        
                static            mixed
    get(ArrayAccess|array $array, string|int|null $key, mixed $default = null)
        
    
    Get an item from an array using "dot" notation.
        
                static            bool
    has(ArrayAccess|array $array, string|array $keys)
        
    
    Check if an item or items exist in an array using "dot" notation.
        
                static            bool
    hasAll(ArrayAccess|array $array, string|array $keys)
        
    
    Determine if all keys exist in an array using "dot" notation.
        
                static            bool
    hasAny(ArrayAccess|array $array, string|array $keys)
        
    
    Determine if any of the keys exist in an array using "dot" notation.
        
                static            bool
    every(iterable $array, callable $callback)
        
    
    Determine if all items pass the given truth test.
        
                static            bool
    some(iterable $array, callable $callback)
        
    
    Determine if some items pass the given truth test.
        
                static            int
    integer(ArrayAccess|array $array, string|int|null $key, int|null $default = null)
        
    
    Get an integer item from an array using "dot" notation.
        
                static            bool
    isAssoc(array $array)
        
    
    Determines if an array is associative.
An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
        
                static            bool
    isList(array $array)
        
    
    Determines if an array is a list.
An array is a "list" if all array keys are sequential integers starting from 0 with no gaps in between.
        
                static            string
    join(array $array, string $glue, string $finalGlue = '')
        
    
    Join all items using a string. The final items can use a separate glue string.
        
                static            array
    keyBy(iterable $array, callable|array|string $keyBy)
        
    
    Key an associative array by a field or using a callback.
        
                static            array
    prependKeysWith(array $array, string $prependWith)
        
    
    Prepend the key names of an associative array.
        
                static            array
    only(array $array, array|string $keys)
        
    
    Get a subset of the items from the given array.
        
                static            array
    select(array $array, array|string $keys)
        
    
    Select an array of values from an array.
        
                static            array
    pluck(iterable $array, string|array|int|Closure|null $value, string|array|Closure|null $key = null)
        
    
    Pluck an array of values from an array.
        
                static    protected        array
    explodePluckParameters(string|array|Closure $value, string|array|Closure|null $key)
        
    
    Explode the "value" and "key" arguments passed to "pluck".
        
                static            array
    map(array $array, callable $callback)
        
    
    Run a map over each of the items in the array.
        
                static            
    mapWithKeys(array $array, callable $callback)
        
    
    No description
        
                static            
    mapSpread(array $array, callable $callback)
        
    
    No description
        
                static            array
    prepend(array $array, mixed $value, mixed $key = null)
        
    
    Push an item onto the beginning of an array.
        
                static            mixed
    pull(array $array, string|int $key, mixed $default = null)
        
    
    Get a value from the array, and remove it.
        
                static            string
    query(array $array)
        
    
    Convert the array into a query string.
        
                static            mixed
    random(array $array, int|null $number = null, bool $preserveKeys = false)
        
    
    Get one or a specified number of random values from an array.
        
                static            array
    set(array $array, string|int|null $key, mixed $value)
        
    
    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.
        
                static            array
    push(ArrayAccess|array $array, string|int|null $key, mixed ...$values)
        
    
    Push an item into an array using "dot" notation.
        
                static            array
    shuffle(array $array)
        
    
    Shuffle the given array and return the result.
        
                static            
    sole(array $array, callable|null $callback = null)
        
    
    Get the first item in the array, but only if exactly one item exists. Otherwise, throw an exception.
        
                static            array
    sort(iterable $array, callable|array|string|null $callback = null)
        
    
    Sort the array using the given callback or "dot" notation.
        
                static            array
    sortDesc(iterable $array, callable|array|string|null $callback = null)
        
    
    Sort the array in descending order using the given callback or "dot" notation.
        
                static            array
    sortRecursive(array $array, int $options = SORT_REGULAR, bool $descending = false)
        
    
    Recursively sort an array by keys and values.
        
                static            array
    sortRecursiveDesc(array $array, int $options = SORT_REGULAR)
        
    
    Recursively sort an array by keys and values in descending order.
        
                static            string
    string(ArrayAccess|array $array, string|int|null $key, string|null $default = null)
        
    
    Get a string item from an array using "dot" notation.
        
                static            string
    toCssClasses(array|string $array)
        
    
    Conditionally compile classes from an array into a CSS class list.
        
                static            string
    toCssStyles(array|string $array)
        
    
    Conditionally compile styles from an array into a style list.
        
                static            array
    where(array $array, callable $callback)
        
    
    Filter the array using the given callback.
        
                static            array
    reject(array $array, callable $callback)
        
    
    Filter the array using the negation of the given callback.
        
                static            
    partition($array, callable $callback)
        
    
    No description
        
                static            array
    whereNotNull(array $array)
        
    
    Filter items where the value is not null.
        
                static            array
    wrap(mixed $value)
        
    
    If the given value is not an array and not null, wrap it in one.