Download the PHP package fivelab/ruler without Composer

On this page you can find all versions of the php package fivelab/ruler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ruler

Russia has become a terrorist state.

 #StandWithUkraine 

Ruler

Build Status Latest Stable Version Total Downloads PHP Version Require License

Write a filter as a single string rule and apply it to different query builders — Doctrine ORM, Elasticsearch / OpenSearch (via Elastica or the native clients) and ClickHouse — without rewriting the condition for each backend.

The same rule string produces a DQL WHERE for Doctrine, a bool query for Elasticsearch, or a WHERE clause for ClickHouse — you only change the target you pass in.

Why Ruler?

Installation

Install the packages for the targets you use (they are declared as suggest):

Usage

Create a Ruler for the target(s) you need, then apply() a rule to a query object.

Doctrine ORM

Joins are detected automatically from the dotted path: category.key adds a LEFT JOIN on the category association and filters on its key field. Nested associations (variants.category.key) are supported too.

Elasticsearch / OpenSearch

For the ruflin/elastica client, pass an Elastica\Query:

For the native elasticsearch/elasticsearch or opensearch-project/opensearch-php clients, use RawSearchQuery and read the built body:

apply() only sets the query part, so size, sort, aggs, etc. are preserved. Calling it several times combines the conditions with bool.must.

ClickHouse

The ClickHouse target builds a WHERE string and its parameters for you to embed in your own SQL (placeholders use the smi2/phpclickhouse format):

Multiple targets at once

Wrap several targets in Targets and reuse one Ruler for all of them; it picks the right executor by the query object you pass:

Rule syntax

A rule is a string of conditions combined with and / or. Values are always passed as named parameters (:name); the array you pass to apply() provides them.

Operators

Category Operators
Comparison =, !=, <, <=, >, >=
Set in (:param), not in (:param)
Text like
Logical and, or
Arithmetic +, -, *, /

Good to know

A few current constraints of the parser:

The full reference — precedence, constants, null checks, errors and the differences between the backends — is in docs/targets.md.

Specifications

Rules can be wrapped in reusable, composable specifications and applied with applySpec():

OrX, EmptySpecification and TargetableSpecification (a single specification that carries a different rule per target, resolved with SpecificationFilter::filterByTarget()) are available too.

A composite renames the duplicated parameters of its specifications (:status, :status_1, …), so one specification can appear in it several times. The renaming does not reach across separate applySpec() calls on one query — see Duplicated names.

Extending

See docs/extending.md for complete examples.

Documentation

Security

To report a vulnerability, see SECURITY.md.

Migrating from RulerZ

kphoen/rulerz solves a similar problem but has had no release since 2018. Ruler is a maintained alternative for the Doctrine ORM and Elasticsearch use cases, with ClickHouse support added. A few differences to keep in mind when migrating:

Requirements

Development

For easy development you can use Docker.

After the container starts, install the vendors:

Before opening a PR, please run the checks:

License

Ruler is released under the MIT License.


All versions of ruler with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fivelab/ruler contains the following files

Loading the files please wait ...