A Laravel/PHP Package for Minimizing Collection/Array Iterations
Install the package via composer:
composer require hassan/one-loop
$users = App\User::all();
$ids = one_loop($users)->reject(static function ($user) {
return $user->age < 20;
})
->map(static function ($user) {
return $user->id;
})
->apply();
If you discover any security related issues, please email hello@hassan-ali.me instead of using the issue tracker.