PHP code example of carlosv2 / funnel

1. Go to this page and download the library: Download carlosv2/funnel 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/ */

    

carlosv2 / funnel example snippets


use carlosV2\Funnel\Funnel;
use Everzet\PersistedObjects\Repository;

class MyTestingRepository
{
    /**
     * @var Funnel
     */
    private $repository;
    
    /**
     * @param Repository $repository
     */
    public function __construct(Repository $repository)
    {
        $this->repository = new Funnel($repository);
    }
    
    // ...
}

$objects = $funnel->findBy(function ($object) {
    return $object->getData() === 'foo';
});

$myArray = [$obj1, $obj2, $obj3];

// Any Funnel-compatible method can be used here
Funnel($myArray)->countByType(\DateTime::class);