Download the PHP package rikta/php-query without Composer

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

PhpQuery

packagist name version php version

license GitHub commit activity open issues closed issues

ci dependabot maintainability score tech debt % maintainability issues

Fluently Query a repository or array for items that match certain criteria and arrange the results in a particular order.

Like a low-budget php version of an ORM-library where budget wasn't even enough for a database and we have to be happy with in-session-memory.

Contrary to the proper db-based libraries this one works on anything that can be represented inside a key-value store or array.

Just wrap a collection of something (Arrays, Files in a Directory, a decoded CSV-File) into a rikta/repository and fire a query on it.

You could also store the query on a variable and then call it for different repositories, or use it as a configurable getter.

(For your convenience you can also just pass an array; it will be converted into an ArrayRepository automatically)

Installation

composer require rikta/php-query

No config, no dependency-injection, nothing. Plug&Play!

Usage

  1. Create a new query object, e.g. $query = new Query();
  2. Add some operations, e.g. $query->not()->isNull()->sort()->limit(10)
  3. Get your result-object, e.g. $result = $query->getResults()
  4. Get your items from the result, e.g. return $result->toArray() (with keys) or return $result->getItems() (without keys)

Example

The examples-directory contains several examples (those are part of a testsuite and therefore guaranteed to work)

One of the rather verbose ones, it uses a list of 100 popular classical books as input and finds the three biggest english books after 1900 mapped to their authors

Operations

Operations are invokable objects (= callables with a state, you could say) that

Operations are divided into multiple categories. Every operation will retain the initial keys in its return (unless specifically instructed otherwise).

QueryOperation Categories:

Filter

Filters the keys/values, e.g. against an array of a callable

Check _FilterOperationMethodsInterface for an up-to-date overview of all implemented filter-methods

Examples:

Juggling

Modifies the arrays order and bounds, but not the values themselves (Except maybe discarding them)

Check _JugglingOperationMethodsInterface for an up-to-date overview of all implemented filter-methods

Examples:

Modification

Modifies another Operation

Check _ModificationOperationMethodsInterface for an up-to-date overview of all implemented filter-methods

Examples:

Replacement

Replaces the keys/values, e.g. with a value from a path or with the result of a callable

Check _ReplacementOperationMethodsInterface for an up-to-date overview of all implemented filter-methods

Examples:

Why the name?

The initial name was just "Query", but during development I ended up with Namespaces like Rikta\Query\Query\Query, so I renamed the project to mitigate this redundancy a bit.

I'm open for any suggestions on a better name ;)


All versions of php-query with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-json Version *
rikta/repository Version dev-main
rikta/timed-loop Version ^1.0
rikta/value-path Version ^0.1.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 rikta/php-query contains the following files

Loading the files please wait ....