Download the PHP package braincrafted/arrayquery without Composer

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

ArrayQuery

ArrayQuery is a library to query arrays.

Build Status Scrutinizer Quality Score Code Coverage

Motivation

Data is often stored in arrays of arrays (for example, after reading it from CSV) and some items (or rows) have to be picked out before the data can be further processed or stored in a database. Writing such code is not very hard, but it often gets messy. Loops within loops, multiple if or switch statement, temporary variables and so on. ArrayQuery provided a clean and testable interface (inspired by query builders from ORMs) for these "array queries."

Installation

ArrayQuery can be installed using Composer:

Usage

The ArrayQuery object has to be initialized with a SelectEvaluation and a WhereEvaluation object. Filters can be added to SelectEvaluation and filters and operators can be added to WhereEvaluation.

However, the QueryBuilder can be used to create an instance of ArrayQuery with built-in operators and filters.

The query object can be used to build queries and execute them. Building the query object contains of three steps:

  1. Select the fields to be returned
  2. From the datasource
  3. Where a clause is matched

When the query is built it has to be executed.

Select

All elements of an item can be selected using the star * operator:

Single elements of an item can be selected:

Multiple elements of an item can be selected:

Filters can be applied in both cases:

Multiple filters can also be applied:

From

Next the data source from which to select from has to be defined:

Where

Where clauses define which items from the data source are put in the result set:

There are numerous different operators available, which can be defined as third parameter:

Before the clause is evaluated filters can be applied to the test value:

Filters can have arguments:

Execute

There are multiple ways to execute a query.

Find all results:

Find one result:

Note: For performance reasons the first result is returned immediately. There is no error or exception when multiple results are returned.

Find scalar results:

Note: This only works when only one field is selected, an exception is thrown when multiple fields are selected (either through enumeration or by using the star operator).

Find one scalar result:

Note: The same notes as for findOne() and findScalar() apply here.

Builtin operators and filters

Some operators and filters are builtin and can be used out of the box (if the QueryBuilder is used to create the ArrayQuery object).

Operators

Filters

Filters can optionally have arguments. Separate arguments from the filter name by a space and separate multiple arguments using a comma.

Author

License

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Bitdeli Badge


All versions of arrayquery with dependencies

PHP Build Version
Package Version
No informations.
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 braincrafted/arrayquery contains the following files

Loading the files please wait ....