Download the PHP package aplia/query without Composer

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

Aplia Content Query

Simplified API for doing content queries in eZ publish legacy.

Latest Stable Version Minimum PHP Version

Installation

Install with Composer:

Overview

It is divided in three main areas.

All classes support the eZ template attribute system and can be passed directly to templates.

QuerySet

This class combines the functionality of all the other system into one easy to use interface. Once instantiated there are several methods which can be used to filter the set and return a new queryset instance.

Iterator usage

The query-set acts as an iterator and can be passed to foreach statements directly.

The query-set is lazy and will only evaluate when needed. It will also cache results so iterating a second time without changing any filters will not access the database.

Chaining and cloning

Most methods are designed to return a query-set instance upon completion to allow for chaining multiple methods.

For instance:

The query-set can also be instructed to create new clones for each change that is made to it, this means that the chaining methods will create new copies and that the original instance is kept as-is.

To explicitly create a new clone call copy():

List all children

Example, list all children of the root node:

List specific content class

List only articles of the root node:

List tree structure

List entire tree of a given node (node id 42):

List specific depth

List a specific depth using an operator:

Change sort order

Change sort order to alphabetical:

Creating a new sort field and sorting on that:

Use a regular sort array:

Paginate results

Use pagination and fetch specific page:

Filter on fields

Filter by fields:

Filters may also define modifiers on the field or value by using the advanced syntax from NestedFilter.

e.g. to use a modifier called first_letter change the attribute name to include a colon and then the modifier followed by another colon and the operator. The modifier must first be defined in filter.ini and point to a valid static method, see aplia/query package for more details on modifiers.

Example which finds all articles that starts with M

Define filters from database

Load filters from the content class:

Custom nested filters

If the default filter system is too limiting then the custom filters may be used instead. They are nested filters which are passed to the NestedFilter system (aplia/query package) which supports arbitrary nesting of AND/OR structures with filters.

Call the addFilter method on the query set and pass the filters you want. Calling it multiple times will AND the filters together.

Custom filters can be used together with normal filters.

Accessing result object

To explicitly get the result object (e.g. for templates) use result().

The result object contains enough information to be used in a template, for instance showing the total count, used filters and listing items.

Accessing items explicitly

The query-set acts as an iterator but if you need the item list directly call items():

Control visibilty

Turn off default visibilty rules:

Only list hidden items (this turns off default rules):

Limit to main nodes

Limit result to only main nodes:

Control roles/policies

Turn off all role-based policies:

Filter based on a custom policy array:

Pagination

BaseNumPagination defines the main interface for all pagination concrete classes.

A concrete implementation is PageNumPagination which provides pagination based on numeric page numbers (1 and up).

Sorting

Sorting is handled by the SortOrder class, it provides a way to define possible sort columns for an API and also which sort column and order has been chosen.

Filtering

...

Results

After running the query a result object is returned, it is of type Result and contains all the results of the query, including items, total count, page object, sort order and filters.

License

The helper library is open-sourced software licensed under the MIT license.


All versions of query with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
composer/composer Version >=1.0
aplia/support Version ^1.0.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 aplia/query contains the following files

Loading the files please wait ....