PHPackages                             carlosv2/funnel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. carlosv2/funnel

ActiveLibrary[Testing &amp; Quality](/categories/testing)

carlosv2/funnel
===============

Little testing repositories enhancer

1.1.3(9y ago)02.5kMITPHPPHP ~5.3 || ~7.0

Since Nov 8Pushed 9y ago1 watchersCompare

[ Source](https://github.com/carlosV2/Funnel)[ Packagist](https://packagist.org/packages/carlosv2/funnel)[ RSS](/packages/carlosv2-funnel/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Funnel
======

[](#funnel)

Little testing repositories enhancer.

[![License](https://camo.githubusercontent.com/0d10533f0408e2b9f1e5e9084a59e4afa2008392dacaa24d200abac3668f73b5/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7376322f66756e6e656c2f6c6963656e7365)](https://packagist.org/packages/carlosv2/funnel)[![Build Status](https://camo.githubusercontent.com/70b97f16c9480288b4050ada92b9a702bfb771716320e7e0bb3f24a2ecf65015/68747470733a2f2f7472617669732d63692e6f72672f6361726c6f7356322f46756e6e656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/carlosV2/Funnel)[![SensioLabsInsight](https://camo.githubusercontent.com/c2686d98e3948140e5f1770141bdc91436be2f35c82ce24b3573329c42fa13ee/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39396266396137622d393632302d346234322d393165352d6439343366656437383632632f6d696e692e706e67)](https://insight.sensiolabs.com/projects/99bf9a7b-9620-4b42-91e5-d943fed7862c)

This project aims to provide quick and easy filtering capabilities to [everzet/persisted-objects](https://github.com/everzet/persisted-objects).

Usage
-----

[](#usage)

You just need to decorate the testing repository with `carlosV2\Funnel\Funnel`. For example:

```
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);
    }

    // ...
}
```

Funnel also implements `Everzet\PersistedObjects\Repository` so you don't lose any feature and yet you gain some more instead:

- findAll(): Returns an array with all the objects. This is an alias for `getAll`.
- findBy(callable): Returns an array with all the matching objects. Empty array is returned if none is found.
- findOneBy(callable): Returns the first matching object or null if none is found.
- countBy(callable): Returns an integer representing the number of matching objects.

For example:

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

In addition, Funnel provides some generic filters that can be used to speed up development:

- [AllOfFilter](https://github.com/carlosV2/Funnel/blob/master/docs/AllOfFilter.md)
- [AnyOfFilter](https://github.com/carlosV2/Funnel/blob/master/docs/AnyOfFilter.md)
- [MethodFilter](https://github.com/carlosV2/Funnel/blob/master/docs/MethodFilter.md)
- [MethodsFilter](https://github.com/carlosV2/Funnel/blob/master/docs/MethodsFilter.md)
- [PropertyFilter](https://github.com/carlosV2/Funnel/blob/master/docs/PropertyFilter.md)
- [PropertiesFilter](https://github.com/carlosV2/Funnel/blob/master/docs/PropertiesFilter.md)
- [TypeFilter](https://github.com/carlosV2/Funnel/blob/master/docs/TypeFilter.md)
- [BeingFilter](https://github.com/carlosV2/Funnel/blob/master/docs/BeingFilter.md)
- [HavingFilter](https://github.com/carlosV2/Funnel/blob/master/docs/HavingFilter.md)

Those filters can be used by composing a new method applying the following rule (where "Not" is optional):

```
   find |
findOne > + By + [Not] + Filter
  count |

```

For example:

- findByProperty(...): Finds all the objects that have the given property and value.
- findOneByMethod(...): Finds the first object that matches the given method and value.
- countByNotType(...): Counts all the objects that don't have the given type.

If none of the provided filters match your requirements, you can also add [your own filters](https://github.com/carlosV2/Funnel/blob/master/docs/YourOwnFilter.md)to Funnel to make them available when composing new methods.

Feel free to create a pull request with your own generic filters! :)

Alternatively, you can decorate an array in order to provide the Funnel API on top of it. For example:

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

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

Install
-------

[](#install)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this project:

```
$ composer require carlosv2/funnel
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Total

5

Last Release

3426d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.5

1.1.0PHP ~5.5 || ~7.0

1.1.3PHP ~5.3 || ~7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2642839?v=4)[Carlos Ortega](/maintainers/carlosV2)[@carlosV2](https://github.com/carlosV2)

---

Top Contributors

[![carlosV2](https://avatars.githubusercontent.com/u/2642839?v=4)](https://github.com/carlosV2 "carlosV2 (33 commits)")

---

Tags

filesystemtestrepositoryPersistedObjects

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carlosv2-funnel/health.svg)

```
[![Health](https://phpackages.com/badges/carlosv2-funnel/health.svg)](https://phpackages.com/packages/carlosv2-funnel)
```

###  Alternatives

[infyomlabs/laravel-generator

InfyOm Laravel Generator

3.8k2.4M13](/packages/infyomlabs-laravel-generator)[everzet/persisted-objects

Overly simplistic persistance implementations for functional testing

13270.8k5](/packages/everzet-persisted-objects)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
