Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Array Laravel Package

minwork/array

Minwork Array provides fast, well-tested helpers for nested, associative, and object arrays. Get/set/has plus map, filter, find, group, sort, and validation, with fluent-style chaining. No dependencies; modern PHP syntax.

View on GitHub
Deep Wiki
Context7

Computations

sum

Definition

Arr::sum(array ...$arrays): array

Description

Sum associative arrays by their keys into one array

Examples

$arrays = [
    [
        'a' => 1,
        'b' => -3.5,
        'c' => 0,
        3
    ],
    [
        2,
        'a' => 0,
        'c' => -5,
        'd' => PHP_INT_MAX,
    ],
    [
        -5,
        'b' => 3.5,
        'a' => -1,
        'c' => 5,
    ],
    [
        'd' => PHP_INT_MAX,
    ],
    [
        'd' => 2 * -PHP_INT_MAX,
    ]
];

Arr::sum(...$arrays) ->
[
    0,
    'a' => 0,
    'b' => 0,
    'c' => 0,
    'd' => 0,
]

Arr::sum([null, '', false], ['1', true, 'test']) -> [1, 1, 0]

diffObjects

Declaration

Arr::diffObjects(array $array1, array $array2, array ...$arrays): array

Description

Compute difference between two or more arrays of objects

Examples

$object1 = new \stdClass();
$object2 = new \stdClass();
$object3 = new \stdClass();

Arr::diffObjects(
    [$object3, $object1, $object2], 
    [$object3], [$object2]
) -> [1 => $object1]

Arr::diffObjects(
    [$object3, $object1, $object2], 
    [$object3], 
    [$object1, $object2]
) -> []

Arr::diffObjects(
    [$object1], 
    [$object3], 
    [$object2], 
    []
) -> [$object1]

intersectObjects

Definition

Arr::intersectObjects(array $array1, array $array2, array ...$arrays): array

Description

Compute intersection between two or more arrays of objects

Examples

$object1 = new \stdClass();
$object2 = new \stdClass();
$object3 = new \stdClass();

Arr::intersectObjects(
    [$object3, $object1, $object2], 
    [$object3, $object2], 
    [$object2]
) -> [2 => $object2]

Arr::intersectObjects(
    [$object3, $object1, $object2], 
    [$object3], 
    [$object1, $object2]
) -> []

Arr::intersectObjects(
    [$object1, $object2, $object3, $object1], 
    [$object1, $object2]
) -> [$object1, $object2, 3 => $object1]
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings