amo / collection
集合抽象库扩展
v0.0.4
2022-04-20 07:24 UTC
Requires
- php: ^7.1 || ^8.0
- doctrine/collections: >=1.5
Requires (Dev)
- phpunit/phpunit: >=6.5
This package is not auto-updated.
Last update: 2024-09-18 19:23:35 UTC
README
集合管理,深受 Doctrine ArrayCollection 启发
安装
composer require amo/collection
用法
// Static instantiation Collection::make($repository->findBy($criterias)) // map method, allows to create a new collection // based on each item of the given collection ->map(function(User $user){ return $user->getEmail(); }) // each method, executes a closure fore each item of a collection ->each(function(String $email) { $message = $this->buildMessage($email); $this->mailer->send($message); }); // etc...