Download the PHP package ensi/laravel-elastic-query-specification without Composer

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

Laravel Elastic Query Specification

Latest Version on Packagist Tests Total Downloads

Extension for ensi/laravel-elastic-query to describe queries in a declarative way.

Installation

  1. Install ensi/laravel-elastic-query https://github.com/ensi-platform/laravel-elastic-query#installation
  2. Install this package via composer:

Version Compatibility

Laravel Elastic Query Specification Laravel PHP Laravel Elastic Query
^0.1.0 ^8.0 ^8.0 ^0.2.0
^0.2.0 ^8.0 ^8.0 ^0.3.0
^0.2.3 ^8.0 || ^9.0 ^8.0 ^0.3.0
^0.3.0 ^8.0 || ^9.0 ^8.0 ^0.3.0
^7.x (see details) ^9.0 || ^10.0 || ^11.0 ^8.1 ^7.1.0
^8.0.0 ^8.0 || ^9.0 ^8.0 ^8.0
^8.0.2 ^8.0 || ^9.0 || ^10.0 ^8.0 ^8.0
^8.0.3 ^8.0 || ^9.0 || ^10.0 || ^11.0 ^8.0 ^8.0.23
^8.1.0 ^9.0 || ^10.0 || ^11.0 ^8.1 ^8.1.0

Basic usage

All types of declarative queries are based on the specification. It contains definitions of available filters, sorts, and aggregates.

Here are examples of queries for this specification.

The nested method adds specifications for nested documents. The names of filters, aggregates, and sorts are exported from them to the global scope without adding any prefixes. It is acceptable to have the same names for filters, but not for other components.

In the specifications for nested documents, only the fields of these documents can be used.

It is acceptable to add several specifications for the same nested field.

The where* constraints allow you to set additional program selection conditions that cannot be changed by the client. The constraints specified in the root specification are always applied. Constraints in the nested specifications are only used as additions to filters, aggregates, or sorts added to the query. For example, if there is no active filter in the nested specification, then the constraints from this specification will not fall into the filters section of the Elasticsearch query.

The allowedFilters method determines the filters available to the client. Each filter must contain a unique name within the specification. At the same time, in the root and nested specifications or in different nested specifications, the names may be repeated. All filters with the same name will be filled with one value from the query parameters.

In addition to the name of the filter itself, you can separately specify the name of the field in the index for which it is applied, and the default value.

Types of filters

The sorts available to the client are added by the allowedSorts method. The sorting direction is set in its name. The sign + or the absence of a sign corresponds to the ascending order, - to the descending order. By default, ascending sorting is used with the minimum selection, if there are several values in the field.

To sort from a nested specification, all constraints and active filters from the same specification are taken into account.

Aggregates are declared with the allowedAggregates method. The client specifies in the query parameters a list of names of aggregates, the results of which he expects in the response.

Types of aggregates

Aggregates from nested specifications are added to the Elasticsearch query with all constraints and active filters.

You can use the allowedFacets method to define facets. Each facet requires an aggregate and one or more filters. You can use both the existing aggregate

and the aggregate created by the facet itself

Filters are registered in the specification separately. Only their names are passed to facet creation methods.

During the calculation of the available values for each facet, all set filters are applied except those associated with this facet.

Search for documents

Calculation of summary indicators

Determining the available facet values

Elasticsearch 7 and 8 support.

Due to the incompatibility of clients for Elasticsearch 7 and 8, separate releases will be created for these versions. Development for each version is carried out in the corresponding branch.

To make changes to version 7, you need to create a task branch based on v7 and make a pull request to it. For version 8 it is similar, but based on the v8 branch.

Contributing

Please see CONTRIBUTING for details.

Testing

  1. composer install
  2. start Elasticsearch in your preferred way
  3. if you need change ELASTICSEARCH_HOSTS, copy phpunit.xml.dist to phpunit.xml and fill value
  4. composer test

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-elastic-query-specification with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ensi/laravel-elastic-query Version ^8.1.0
laravel/framework Version ^9.0 || ^10.0 || ^11.0
webmozart/assert Version ^1.11
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 ensi/laravel-elastic-query-specification contains the following files

Loading the files please wait ....