Download the PHP package hyvor/doctrine-filterq without Composer

On this page you can find all versions of the php package hyvor/doctrine-filterq. 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 doctrine-filterq

FilterQ for Doctrine ORM

FilterQ allows advanced filtering in Symfony APIs using Doctrine ORM. You can accept a single-line expression from your users like:

And FilterQ will convert it to DQL WHERE conditions in your Doctrine QueryBuilder.


FilterQ was built for Hyvor Blogs' Data API. It was initially written for Laravel Eloquent and later ported to Doctrine ORM.


Features

FilterQ Expressions

Example: (published_at > 1639665890 & published_at < 1639695890) | is_featured=true

A FilterQ Expression is a combination of conditions, connected and grouped using one or more of the following.

A condition has three parts:

Key

Usually, a key maps to a DQL column reference (e.g., p.id, a.name). It should match [a-zA-Z0-9_.]+.

Operators

By default, the following operators are supported.

Values

Basic Usage

The FilterQ::expression() static method is the entry point. The chain must end with addWhere(), which adds WHERE conditions to the QueryBuilder and returns it.

1. Setting the Expression and QueryBuilder

addWhere() returns the Doctrine ORM QueryBuilder so you can continue chaining:

2. Set Keys

Define all keys the user is allowed to filter on. This prevents SQL injection — only the columns you explicitly allow can be used in expressions.

Joins

To filter on a related entity's field, use a join callback. The callback receives the QueryBuilder.

Even if the same key appears multiple times in the expression, the join callback is only called once.

Key Operators

Restrict which operators are allowed for a key.

Key Value Types

Define the expected type for a key's value. Highly recommended for security and data integrity.

Supported types:

Scalar: int, float, string, null, bool

Special:

Multiple types can be combined with | or as an array:

Key Values

Restrict a key to a specific set of allowed values. Useful for enum columns.

Custom Operators

Add custom DQL operators. The callback receives the QueryBuilder, an auto-generated parameter name, and the value. It must bind the parameter and return the DQL expression string.

For more complex cases, use a callback:

The callback signature is (QueryBuilder $qb, string $paramName, mixed $value): string. It should:

  1. Bind the value with $qb->setParameter($paramName, $value) if needed.
  2. Return a DQL expression string.

Removing an Operator

Exception Handling

FilterQ throws three exceptions, all extending FilterQException:


All versions of doctrine-filterq with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
doctrine/orm Version ^2.17|^3.0
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 hyvor/doctrine-filterq contains the following files

Loading the files please wait ...