PHPackages                             consolidation/filter-via-dot-access-data - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. consolidation/filter-via-dot-access-data

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

consolidation/filter-via-dot-access-data
========================================

This project uses dflydev/dot-access-data to provide simple output filtering for applications built with annotated-command / Robo.

2.0.3(6mo ago)4646.9M—4.1%4[1 PRs](https://github.com/consolidation/filter-via-dot-access-data/pulls)8MITPHPPHP &gt;=7.1.3CI passing

Since Jul 19Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/consolidation/filter-via-dot-access-data)[ Packagist](https://packagist.org/packages/consolidation/filter-via-dot-access-data)[ RSS](/packages/consolidation-filter-via-dot-access-data/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (25)Used By (8)

FilterViaDotAccessData
======================

[](#filterviadotaccessdata)

This project uses [dflydev/dot-access-data](https://github.com/dflydev/dflydev-dot-access-data) to provide simple output filtering for applications built with [annotated-command](https://github.com/consolidation/annotated-command) / [Robo](https://github.com/consolidation/robo).

[![ci](https://github.com/consolidation/filter-via-dot-access-data/workflows/CI/badge.svg)](https://travis-ci.org/consolidation/filter-via-dot-access-data)[![scrutinizer](https://camo.githubusercontent.com/6b6bd0484171ee1f3a44f88f6841a52163607e4aa6beb9c0cb5113670b8e76ec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6e736f6c69646174696f6e2f66696c7465722d7669612d646f742d6163636573732d646174612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/consolidation/filter-via-dot-access-data/?branch=master)[![codecov](https://camo.githubusercontent.com/792fc0f7ba5dbe163bb03b419febb9905557d9bad81385145584fffb85e1ee8a/68747470733a2f2f636f6465636f762e696f2f67682f636f6e736f6c69646174696f6e2f66696c7465722d7669612d646f742d6163636573732d646174612f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d43416142376f66687878)](https://codecov.io/gh/consolidation/filter-via-dot-access-data)[![License](https://camo.githubusercontent.com/48ec640df7aa98ffef21cc458ad62f485e8c6afaab5ab4da8d13d84e1cd7779e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3430383637372e737667)](LICENSE)

Overview
--------

[](#overview)

This project provides a simple logic expression evaluator which can be used in conjunction with [dflydev/dot-access-data](https://github.com/dflydev/dot-access-data) to filter out results of the sort that you might return as a RowsOfFields object, or a nested yaml/json array.

### API

[](#api)

To use this filter in your annotated-commands-aware application (see [g1a/starter](https://github.com/g1a/starter)), ensure that the filter hooks are registered with

```
$commandClasses = [
    \Consolidation\Filter\Hooks\FilterHooks::class,   // Filter hooks
    \MyApp\Commands\MyCommands::class,                // Commandfiles for your application
];
$runner = new \Robo\Runner($commandClasses);

```

Then, any command that returns RowsOfFields data (see [consolidation/output-formatters](https://github.com/consolidation/output-formatters)) or an array may utilize the output filter feature simply by annotating its command method with `@filter-output`.

```
    /**
     * Convert a command from one format to another, potentially with filtering.
     *
     * @command example
     * @filter-output
     * @return array
     */
    public function example(array $parameters, $options = ['format' => 'yaml'])
    {
        return $this->doSomething($parameters);
    }

```

Annotating a command in this way will automaitically attach a `--filter[=FILTER]` option to the command. The output of the command may then be filtered by providing a simple expression:

```
$ mycmd example p1 p2 --filter='color=red'

```

A `contains` comparison may be done via the `*=` operator:

```
$ mycmd example p1 p2 --filter='color*=red'

```

And, finally, regex compares are also available via `~=`:

```
$ mycmd example p1 p2 --filter='color~=#^red.*#'

```

The filter decides whether to include or exclude each **top-level element** based on the result of evaluating the provided expression on each element.

- Nested data elements may be tested, e.g. via `attributes.color=red`
- Simple boolean logic may be used, e.g. `color=red&&shape=round`

Parenthesis are not supported.

Getting Started
---------------

[](#getting-started)

To build this project locally, follow the steps below.

### Prerequisites

[](#prerequisites)

Install dependencies:

```
composer install

```

If you wish to build the phar for this project, install the `box` phar builder via:

```
composer phar:install-tools

```

Running the tests
-----------------

[](#running-the-tests)

The test suite may be run locally by way of some simple composer scripts:

TestCommandRun all tests`composer test`PHPUnit tests`composer unit`PHP linter`composer lint`Code style`composer cs`Fix style errors`composer cbf`Deployment
----------

[](#deployment)

Deploy by the following procedure:

- Edit the `VERSION` file to contain the version to release, and commit the change.
- Run `composer release`

Contributing
------------

[](#contributing)

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the process for submitting pull requests to us.

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [releases](https://github.com/consolidation/filter-via-dot-access-data/releases) page.

Authors
-------

[](#authors)

- [Greg Anderson](https://github.com/greg-1-anderson)

See also the list of [contributors](https://github.com/consolidation/filter-via-dot-access-data/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance68

Regular maintenance activity

Popularity61

Solid adoption and visibility

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 93.6% 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 ~243 days

Recently: every ~623 days

Total

12

Last Release

185d ago

Major Versions

0.4.1 → 1.0.02019-01-18

1.0.0 → 2.0.02021-03-11

PHP version history (2 changes)0.1.0PHP &gt;=5.5.0

2.0.1PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/b34cc6bd882277b6c6dda19bf6631ae5c3a909fd667c826a15121642cdc051b2?d=identicon)[greg.1.anderson](/maintainers/greg.1.anderson)

---

Top Contributors

[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (44 commits)")[![aaronbauman](https://avatars.githubusercontent.com/u/508451?v=4)](https://github.com/aaronbauman "aaronbauman (1 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (1 commits)")[![Rudloff](https://avatars.githubusercontent.com/u/840125?v=4)](https://github.com/Rudloff "Rudloff (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/consolidation-filter-via-dot-access-data/health.svg)

```
[![Health](https://phpackages.com/badges/consolidation-filter-via-dot-access-data/health.svg)](https://phpackages.com/packages/consolidation-filter-via-dot-access-data)
```

###  Alternatives

[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[consolidation/output-formatters

Format text by applying transformations provided by plug-in formatters.

19669.3M18](/packages/consolidation-output-formatters)[grasmash/expander

Expands internal property references in PHP arrays file.

13960.7M6](/packages/grasmash-expander)[dflydev/dot-access-configuration

Given a deep data structure representing a configuration, access configuration by dot notation.

13414.5M4](/packages/dflydev-dot-access-configuration)[caseyamcl/configula

A simple, but versatile, PHP config loader

42146.6k6](/packages/caseyamcl-configula)

PHPackages © 2026

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