hassan/one-loop

A Laravel/PHP Package for Minimizing Collection/Array Iterations

1.0.0 2019-08-13 23:13 UTC

This package is auto-updated.

Last update: 2024-11-13 09:53:28 UTC


README

Latest Version on Packagist Build Status License Coverage Status

A Laravel/PHP Package for Minimizing Collection/Array Iterations

Installation

Install the package via composer:

composer require hassan/one-loop

Usage

$users = App\User::all();

$ids = one_loop($users)->reject(static function ($user) {
    return $user->age < 20;
})
->map(static function ($user) {
    return $user->id;
})
->apply();

Security

If you discover any security related issues, please email hello@hassan-ali.me instead of using the issue tracker.