This project uses dflydev/dot-access-data to provide simple output filtering for cli applications.

Overview

FilterViaDotAccessData

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

ci scrutinizer codecov License

Overview

This project provides a simple logic expression evaluator which can be used in conjunction with 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

To use this filter in your annotated-commands-aware application (see 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) 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

To build this project locally, follow the steps below.

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

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

Test Command
Run all tests composer test
PHPUnit tests composer unit
PHP linter composer lint
Code style composer cs
Fix style errors composer cbf

Deployment

Deploy by the following procedure:

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

Contributing

Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the releases page.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Comments
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated

    Details

    composer.lock

    4 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    opened by dependencies[bot] 6
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 2 updated direct dependencies)

    Details

    composer.lock

    18 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 2 direct dependencies were updated:

    squizlabs/php_codesniffer was updated from 2.9.1 to 2.9.2

    2.9.2

    Final 2.9 Release

    Version 2.9.2 will be the final release of the PHP_CodeSniffer 2.9 branch, first released over 4 years ago. All developers still using version 2 are strongly encouraged to migrate to version 3.

    Version 3 was first released as stable on the 4th of May 2017 and is a large refactoring of the code base that breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide

    Note: If you only use the built-in coding standards (such as PEAR or PSR2), or you have a custom ruleset.xml file that only makes use of the sniffs and reports distributed with PHP_CodeSniffer, you do not need to make any changes to begin using PHP_CodeSniffer version 3.

    Other Changes

    • PHPCS should now run under PHP 7.3 without deprecation warnings
      • Thanks to Nick Wilde for the patch
    • Fixed bug #1496 : Squiz.Strings.DoubleQuoteUsage not unescaping dollar sign when fixing
      • Thanks to Michał Bundyra for the patch
    • Fixed bug #1549 : Squiz.PHP.EmbeddedPhp fixer conflict with // comment before PHP close tag
      • Thanks to Juliette Reinders Folmer for the patch
    • Fixed bug #1890 : Incorrect Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose error between catch and finally statements

    symfony/console was updated from v3.4.17 to v3.4.18

    We didn't find any content for v3.4.18. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 5
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 1 updated direct dependencies)

    Details

    composer.lock

    16 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 1 direct dependencies were updated:

    symfony/console was updated from v3.4.17 to v3.4.18

    We didn't find any content for v3.4.18. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 5
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 3 updated direct dependencies)

    Details

    composer.lock

    17 transitive dependencies were updated, 1 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 3 direct dependencies were updated:

    g1a/composer-test-scenarios was updated from 2.1.0 to 2.2.0

    We didn't find any content for 2.2.0. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    knplabs/github-api was updated from 2.8.0 to 2.10.1

    2.10.1

    See the change log for an overview of all changes.

    symfony/console was updated from v3.4.12 to v3.4.17

    We didn't find any content for v3.4.17. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 5
  • Filtering 3+ (or 2, in some circumstances) fields does not work

    Filtering 3+ (or 2, in some circumstances) fields does not work

    Overview

    This pull request demonstrates unexpected behavior when using 3 filters.

    Expected:

    • 3 filters get applied to results

    Observed:

    • Only the 1st filter (from left to right) works as expected.
    • The 2nd and 3rd filters get mangled.

    | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Has tests? | yes | BC breaks? | no
    | Deprecations? | no

    Summary

    Right now, this PR is only a test to demonstrate the behavior.

    Description

    Still todo: fix the bug.

    opened by aaronbauman 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 2 updated direct dependencies)

    Details

    composer.lock

    17 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 2 direct dependencies were updated:

    squizlabs/php_codesniffer was updated from 2.9.1 to 2.9.2

    2.9.2

    Final 2.9 Release

    Version 2.9.2 will be the final release of the PHP_CodeSniffer 2.9 branch, first released over 4 years ago. All developers still using version 2 are strongly encouraged to migrate to version 3.

    Version 3 was first released as stable on the 4th of May 2017 and is a large refactoring of the code base that breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide

    Note: If you only use the built-in coding standards (such as PEAR or PSR2), or you have a custom ruleset.xml file that only makes use of the sniffs and reports distributed with PHP_CodeSniffer, you do not need to make any changes to begin using PHP_CodeSniffer version 3.

    Other Changes

    • PHPCS should now run under PHP 7.3 without deprecation warnings
      • Thanks to Nick Wilde for the patch
    • Fixed bug #1496 : Squiz.Strings.DoubleQuoteUsage not unescaping dollar sign when fixing
      • Thanks to Michał Bundyra for the patch
    • Fixed bug #1549 : Squiz.PHP.EmbeddedPhp fixer conflict with // comment before PHP close tag
      • Thanks to Juliette Reinders Folmer for the patch
    • Fixed bug #1890 : Incorrect Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose error between catch and finally statements

    symfony/console was updated from v3.4.17 to v3.4.18

    We didn't find any content for v3.4.18. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated

    Details

    composer.lock

    2 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    opened by dependencies[bot] 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 3 updated direct dependencies)

    Details

    composer.lock

    16 transitive dependencies were updated, 1 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 3 direct dependencies were updated:

    g1a/composer-test-scenarios was updated from 2.1.0 to 2.2.0

    We didn't find any content for 2.2.0. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    knplabs/github-api was updated from 2.8.0 to 2.10.1

    2.10.1

    See the change log for an overview of all changes.

    symfony/console was updated from v3.4.12 to v3.4.15

    We didn't find any content for v3.4.15. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 3 updated direct dependencies)

    Details

    composer.lock

    16 transitive dependencies were updated, 1 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 3 direct dependencies were updated:

    g1a/composer-test-scenarios was updated from 2.1.0 to 2.2.0

    We didn't find any content for 2.2.0. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    knplabs/github-api was updated from 2.8.0 to 2.10.0

    We didn't find any content for 2.10.0. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    symfony/console was updated from v3.4.12 to v3.4.15

    We didn't find any content for v3.4.15. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 3 updated direct dependencies)

    Details

    composer.lock

    16 transitive dependencies were updated, 1 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 3 direct dependencies were updated:

    g1a/composer-test-scenarios was updated from 2.1.0 to 2.2.0

    We didn't find any content for 2.2.0. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    knplabs/github-api was updated from 2.8.0 to 2.9.0

    2.9.0

    See the change log for on overview of all changes.

    symfony/console was updated from v3.4.12 to v3.4.15

    We didn't find any content for v3.4.15. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 4
  • Update composer.lock

    Update composer.lock

    Overview

    The following dependencies have been updated by dependencies.io:

    • composer.lock was updated (including 2 updated direct dependencies)

    Details

    composer.lock

    19 transitive dependencies were updated, 0 were added, and 0 removed. View the git diff for more details about exactly what changed.

    The following 2 direct dependencies were updated:

    squizlabs/php_codesniffer was updated from 2.9.1 to 2.9.2

    2.9.2

    Final 2.9 Release

    Version 2.9.2 will be the final release of the PHP_CodeSniffer 2.9 branch, first released over 4 years ago. All developers still using version 2 are strongly encouraged to migrate to version 3.

    Version 3 was first released as stable on the 4th of May 2017 and is a large refactoring of the code base that breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide

    Note: If you only use the built-in coding standards (such as PEAR or PSR2), or you have a custom ruleset.xml file that only makes use of the sniffs and reports distributed with PHP_CodeSniffer, you do not need to make any changes to begin using PHP_CodeSniffer version 3.

    Other Changes

    • PHPCS should now run under PHP 7.3 without deprecation warnings
      • Thanks to Nick Wilde for the patch
    • Fixed bug #1496 : Squiz.Strings.DoubleQuoteUsage not unescaping dollar sign when fixing
      • Thanks to Michał Bundyra for the patch
    • Fixed bug #1549 : Squiz.PHP.EmbeddedPhp fixer conflict with // comment before PHP close tag
      • Thanks to Juliette Reinders Folmer for the patch
    • Fixed bug #1890 : Incorrect Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose error between catch and finally statements

    symfony/console was updated from v3.4.17 to v3.4.18

    We didn't find any content for v3.4.18. Feel free to open an issue at https://github.com/dependencies-io/support to suggest any improvements.

    opened by dependencies[bot] 3
Releases(1.0.0)
Owner
Consolidation
Common projects for use by various command line / console tools.
Consolidation
Improved Laravel dot notation for explicit array keys.

Laravel Explicit Array Improved Laravel dot notation for explicit array keys. ?? Supporting If you are using one or more Renoki Co. open-source packag

Renoki Co. 7 Nov 28, 2022
A simple and modern approach to stream filtering in PHP

clue/stream-filter A simple and modern approach to stream filtering in PHP Table of contents Why? Support us Usage append() prepend() fun() remove() I

Christian Lück 1.5k Dec 29, 2022
Output complex, flexible, AJAX/RESTful data structures.

Fractal Fractal provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with J

The League of Extraordinary Packages 3.5k Dec 26, 2022
Advanced Laravel models filtering capabilities

Advanced Laravel models filtering capabilities Installation You can install the package via composer: composer require pricecurrent/laravel-eloquent-f

Andrew Malinnikov 162 Oct 30, 2022
A base API controller for Laravel that gives sorting, filtering, eager loading and pagination for your resources

Bruno Introduction A Laravel base controller class and a trait that will enable to add filtering, sorting, eager loading and pagination to your resour

Esben Petersen 165 Sep 16, 2022
Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.

Laravel Befriended Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked

Renoki Co. 720 Jan 3, 2023
Library that offers Input Filtering based on Annotations for use with Objects. Check out 2.dev for 2.0 pre-release.

DMS Filter Component This library provides a service that can be used to filter object values based on annotations Install Use composer to add DMS\Fil

Rafael Dohms 89 Nov 28, 2022
In Laravel, we commonly face the problem of adding repetitive filtering code, this package will address this problem.

Filterable In Laravel, we commonly face the problem of adding repetitive filtering code, sorting and search as well this package will address this pro

Zoran Shefot Bogoevski 1 Jun 21, 2022
A laravel package to access data from the Strava API.

Laravel Strava Package A laravel package to access data from the Strava API. Compatible with Laravel 5.0 and above. Table of Contents Strava Access Cr

Richie 52 Nov 15, 2022
Login system designed by fragX to validate the user and prevent unauthorized access to confidential data.

Login_System v.0.1 Login system designed by fragX to validate the user and prevent unauthorized access to confidential data. ?? Features Sign In and S

fragX 1 Jan 28, 2022
Get estimated read time of an article. Similar to medium.com's "x min read". Multilingual including right-to-left written languages. Supports JSON, Array and String output.

Read Time Calculates the read time of an article. Output string e.g: x min read or 5 minutes read. Features Multilingual translations support. Static

Waqar Ahmed 8 Dec 9, 2022
Validate your input data in a simple way, an easy way and right way. no framework required. For simple or large. project.

wepesi_validation this module will help to do your own input validation from http request POST or GET. INTEGRATION The integration is the simple thing

Boss 4 Dec 17, 2022
View themes is a simple package to provide themed view support to Laravel.

Laravel View Themes View themes is a simple package to provide themed view support to Laravel. Installation Add alexwhitman/view-themes to the require

Alex Whitman 15 Nov 29, 2022
These are simple array and object collections that provide convinient methods to manipulate them.

Simple Collections These are simple array and object collections that provide convinient methods to manipulate collections; To install this package ty

Artem 4 Nov 19, 2021
The Laravel Boilerplate Project - https://laravel-boilerplate.com - For Slack access, visit:

Laravel Boilerplate (Current: Laravel 8.*) (Demo) Demo Credentials Admin: [email protected] Password: secret User: [email protected] Password: secret Offici

Anthony Rappa 5.4k Jan 7, 2023
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

Ollie Codes 19 Jul 5, 2021
Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Jameson Lopp 28 Dec 19, 2022
An interface for the administrator to easily change application settings. Uses Laravel Backpack

Backpack\Settings An interface for the administrator to easily change application settings. Uses Laravel Backpack. Works on Laravel 5.2 to Laravel 8.

Backpack for Laravel 207 Dec 6, 2022
Laravel Simple Access Log

Laravel Simple Access Log Many systems need to log user access for auditing purposes. This package creates a database table with sensible fields for l

Irfaan Nujjoo 0 Jan 13, 2022