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

Iterating

each

Definition

Arr::each(array|Iterator|IteratorAggregate $iterable, callable $callback, int $mode = self::EACH_VALUE): array|Iterator|IteratorAggregate

Description

Traverse through array or iterable object and call callback for each element (ignoring the result).

Modes

$array = [
    1 => [
        2 => 'a',
        3 => 'b',
        4 => [
            5 => 'c',
        ],
    ],
    'test' => 'd',
];

// Value only - using default EACH_VALUE mode
Arr::each($array, function ($value) {
  print_r($value);
  // [ 2 => 'a', ...]
  // 'd'
});

// Key, Value
Arr::each($array, function ($key, $value) {
  echo "{$key}: \t\t";
  print_r($value);
  // 1:      [2 => 'a', ...]
  // test:   'd'
}, Arr::EACH_KEY_VALUE);

// Value, Key
Arr::each($array, function ($value, $key) {
  echo "{$key}: \t\t";
  print_r($value);
  // 1:      [2 => 'a', ...]
  // test:   'd'
}, Arr::EACH_VALUE_KEY);

// Value, Keys list
Arr::each($array, function ($value, ...$keys) {
  echo implode('.', $keys) . ': \t\t';
  print_r($value);
  // 1.2:    'a'
  // 1.3:    'b'
  // 1.4.5:  'c'
  // test:   'd'
}, Arr::EACH_VALUE_KEYS_LIST);


// Keys array, value
Arr::each($array, function (array $keys, $value) {
  echo implode('.', $keys) . ': \t\t';
  print_r($value);
  // 1.2:    'a'
  // 1.3:    'b'
  // 1.4.5:  'c'
  // test:   'd'
}, Arr::EACH_KEYS_ARRAY_VALUE);
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.
teamzac/geocoder
ideatica/config-writer
keaton-php/pipe-dream
jacksonwebservices/laravel-user-suite
maksimru/conditional-laravel-debugbar
gismatul/nova-support-chat
gismatul/laravel-support-chat
networkrailbusinesssystems/oracle-api
alphabalex/messaging-made-easy
rawphp/warp
shootkiran/merobug
narakode/fineauth
numencode/wn-syncops-plugin
ibnnajjaar/mib-global-pay
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel