PHP code example of amo / collection
1. Go to this page and download the library: Download amo/collection library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amo / collection example snippets
// 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...