Download the PHP package onemustcode/query without Composer

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

Build Status Total Downloads Latest Stable Version License

Query

It simply transforms the given filters, sortings and paging to a Doctrine or Eloquent query. Handy for interal usage or it can be used for API's.

Installation

Require the Query library trough composer.

Query

The Query holds the paging, sortings, filters and includes.

Create new Query instance;

Paging

Change the results per page;

Change the page;

Create an Query instance directly from given Paging object;

Filtering

The following filters can be used;

Type Class
Equals new Equals('field', 'value')
Not Equals new NotEquals('field', 'value')
Greather than new GreatherThan('field', 20)
Greather than or Equals new GreatherThanOrEquals('field', 25)
Less than new LessThan('field', 50)
Less than or Equals new LessThanOrEquals('field', 55)
Is null new IsNull('field')
Is not null new IsNotNull('field')
In new In('field', '1,2,3,4,5')
Not in new NotIn('field', '1,2,3,4,5')
Like new Like('field', '%ohn%')

Add new filter to existing Query instance;

Create an Query instance directly from one or more filters;

Sorting

Add new sorting to existing Query instance;

Create an Query instance directly from one or more sortings;

Includes

Add new include to existing Query instance;

Create an Query instance directly from one or more includes;

Builder

Warning: The Builder class is deprecated, use the transformer instead.

The builder turns an given array to an Query instance;

Transformer

The builder transforms an given array to an Query instance;

It is possible to add your own custom filters. In order to do this you should pass them as an associative array in the constructor (note that the filter should implement the OneMustCode\Query\Filters\FilterInterface]). The key should be the filters's operator and the value the filter's FQN;

Writer

The writer can export the given Query instance to json, query parameters and an array.

Json

Array

Query parameters

Doctrine Query Builder

The following example code shows you how to use the Doctrine Query Builder. Just pass the Query instance, Doctrine Query Builder, the accepted filters or sortings and it will automatically generate the query for you.

Example;

It is possible to add your own custom filter handlers. In order to do this you should pass in the handler in the QueryBuilder's constructor (note that the filter handler should implement the OneMustCode\Query\Builders\Doctrine\Filters\FilterHandlerInterface);

License

MIT


All versions of query with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
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 onemustcode/query contains the following files

Loading the files please wait ....