Download the PHP package fattureincloud/api-filter without Composer

On this page you can find all versions of the php package fattureincloud/api-filter. 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 api-filter

FattureInCloud API Filter

This PHP library makes possible to parse a string parameter and use it to initialize a Filter that can be used on REST APIs; the input string is based on a simplified SQL-like WHERE clause, making it easy to understand and use.

The library returns a class-based representation of the filter, that can be used to generate the actual filter to apply to your API requests.

Disclaimer

This library is currently focused on parsing and building the representation of the query, it does not validate the query itself. For example, it doesn't check if a field exists or if it is supported by your filters, and it doesn't enforce permissions checks on the query. You should take care of it on your own.

Even if this filter uses a grammar that should reduce the risk of SQL Injection, you should adopt some strategy to validate the filters and avoid executing unsafe queries.

Install

Via Composer

Usage

To parse a filter string, you can use the FattureInCloud\ApiFilter\FilterFactory class:

The returned filter will be a composition of the classes contained in the FattureInCloud\ApiFilter\Filter package.

The string is based on triplets:

The field is a lowercase string, with dots and underscores.

The op is one of the following (unquoted):

The value can be one of:

You can escape the single quote in a string value by doubling it. The filter will take care of returning the expected string.

It is also possible to match a String against a Pattern using one of those operators:

Like and Contains can also be negated:

Additionally, it is possible to check if field has a value or not, using NULL:

It is possible to use the following operators:

Parenthesis can be used to compose complex expressions.

For example:

Testing

Parser generation

The parser was generated automatically using ANTLR and the PHP target; it is placed in the FattureInCloud\ApiFilter\Parser repository. Usually you should not directly manage the parser: the FilterFactory class is a wrapper that manages it for you.

The grammar is placed under the /grammar folder, if needed you can trigger the parser generation using docker and composer:

If needed, you can generate a parser in another language changing the ANTLR target in the entrypoint.sh file.

License

The MIT License (MIT).


All versions of api-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
antlr/antlr4-php-runtime Version ^0.9.1
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 fattureincloud/api-filter contains the following files

Loading the files please wait ....