PHP code example of xtompie / collection-trait
1. Go to this page and download the library: Download xtompie/collection-trait 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/ */
xtompie / collection-trait example snippets
use Xtompie\Collection\Construct;
use Xtompie\Collection\Count;
use Xtompie\Collection\FilterAsPrivate;
use Xtompie\Collection\Iterator;
final class UserCollection implements Countable, IteratorAggregate
{
use Construct;
use Count;
use FilterAsPrivate;
use Iterator;
public function active(): static
{
return $this->filter(fn (User $user) => $user->isActive());
}
}