Download the PHP package garak/orm-criteria without Composer

On this page you can find all versions of the php package garak/orm-criteria. 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 orm-criteria

ORM Doctrine Criteria

This library is meant to ease the filtering with Doctrine repositories. It's an ideal companion for PUGX FilterBundle.

Setup

Run composer require garak/orm-criteria. No configuration is required.

Usage

The basic idea of this library is applying the Open/Closed principle (the "O" in SOLID), to avoid being forced to change your code every time you need to apply a new filter.

💡 TIP for the concept of "filter", refer to the FilterBundle mentioned above

You have two classes available: AbstractCriterion and Filterer. Inject the latter into your repositories, then you can start creating your criteria.

Let's suppose you have a UserRepository, and you want to filter your users by the following fields: "username", "enabled" (yes/no), and "country".

Let's create the following classes:

Then configure the services:

Now, let's use it in your repository:

Advanced Usage

You can pass your sorting options along wit the filters, like in this example:

$filters['_sort']['field'] = 'username';

$filters['_sort']['direction'] = 'DESC';

If your criterion needs something more sophisticated than the basic operators, you can define a filter method and add your logic. Example:

You can use different kinds of comparison operators, see the constants defined in the Filterer class.

By default, the library expects to find a database name matching the name of the filtered field: for example, in the code above, the filterd field username expects a db field u.username. If it's not the case, you can defined a static property $dbField in your criterion class.


All versions of orm-criteria with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
doctrine/orm Version ^2.7 || ^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 garak/orm-criteria contains the following files

Loading the files please wait ....