Download the PHP package markup/elasticsearch-bundle without Composer

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

A simple Elasticsearch Symfony bundle, by Markup

Build Status Latest Stable Version License: MIT

A Symfony bundle providing simple integration with the Elasticsearch PHP SDK, also providing web profiler information.

Installation

The Markup Elasticsearch bundle can be installed via Composer by requiring themarkup/elasticsearch-bundle package in your project's composer.json, as well as specifying the correct version of the Elasticsearch SDK for the version of Elastic Stack you are using (e.g. use 6.x releases for 6.x releases of Elastic Stack, and 7.x releases for 7.x releases):

and adding an instance of Markup\ElasticsearchBundle\MarkupElasticsearchBundle to your application's kernel:

Configuration

The configuration options for individual Elasticsearch client services are determined by the extended configuration defined by the Elasticsearch PHP SDK. No validation is performed at compile time.

Sample YAML configuration

In the simplest case, a client service (in this case, markup_elasticsearch.client.simple) can be declared by just declaring a client name.

This will set up one connection node for that client, at the default location of http://localhost:9200/.

For a more complex case with explicit defined node(s), these can be defined explicitly (creating here a service called markup_elasticsearch.client.complex):

This will define a client with two nodes, one at https://i_am_a_user:[email protected]:9201/ and one at https://i_am_another_user:[email protected]:9200/.

This will set up a default client as above, with the logger defined as the provided Symfony logger service ID my_logger_service_id (defaulting to logger), and the Kibana location (for running queries in Kibana's Dev Tools interface from the Symfony web profiler) set as https://kibana-host:5601 (and defaulting to http://localhost:5061). The link to Kibana within the Symfony web profiler is switched on by setting should_link_from_profiler to true.

General settings

Connection pools

You can define connection pools on a per-client basis, either using the ConnectionPoolInterface implementations from the Elasticsearch SDK, or a custom connection pool service.

The built-in connection pools are static_no_ping (the default), static, simple and sniffing.

The above configuration will define a client my_client which uses the in-built sniffing connection pool.

The above configuration will define a client my_custom_client which uses a custom connection pool service acme.my_custom_pool.

Connection selectors

You can define connection selectors on a per-client basis, either using the SelectorInterface implementations from the Elasticsearch SDK, or a custom connection selector service.

The built-in connection selectors are round_robin (default), sticky_round_robin and random.

The above configuration will define a client my_selector_client which uses the in-built sticky round-robin connection selector implementation.

The above configuration will define a client my_custom_selector_client which uses a custom connection selector service acme.coin_toss_selector.

Serializers

It is not expected that one would need to configure this, but provided for the sake of completeness:

You can define serializers on a per-client basis, either using the SerializerInterface implementations from the Elasticsearch SDK, or a custom serializer service implementing that interface.

The built-in serializers are smart (default), array_to_json and everything_to_json.

The above configuration will define a client my_serializer_client which uses the in-built everything to JSON serializer implementation.

The above configuration will define a client my_custom_serializer_client which uses a custom serializer service acme.mangled_serializer.

HTTP Handlers (RingPHP)

It is not expected that one would need to configure this, but provided for the sake of completeness:

The Elasticsearch SDK uses RingPHP HTTP handlers under the hood. Generally the default handler is fine for most cases, but there may be small performance gains etc to be had using a different, or even custom, handler. The Elasticsearch SDK docs on handlers has more information.

The built-in RingPHP-compatible handlers are default (default), single and multi.

The above configuration will define a client my_handler_client which uses an in-built handler able to make multiple calls concurrently. (The default handler also does this, but has some logic to determine when to use it.)

The above configuration will define a client my_custom_handler_client which uses a custom RingPHP handler service acme.edison_handler that seems to be named after Thomas Edison. For more information about writing a RingPHP HTTP handler, read the project's documentation on handlers.

Connection Factories

You can define connection factories on a per-client basis using a custom service that implements ConnectionFactoryInterface from the Elasticsearch SDK.

There are no in-built connection factories aside from the default implementation.

The above configuration will define a client my_custom_connection_factory_client which uses a custom connection factory service acme.performant_factory.

Usage

Clients as defined above are provided as instances of \Elasticsearch\Client. Usage from that point is as per the Elasticsearch PHP SDK documentation.

For example, to inject a configured Elasticsearch client into a service at My\SearchService, sample YAML configuration might look like:

The client services are defined as private, and therefore require to be injected into e.g. controllers and other services.

Links


All versions of elasticsearch-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
elasticsearch/elasticsearch Version ^6|^7
symfony/framework-bundle Version ^3.4|^4
markup/json Version ^0.1
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 markup/elasticsearch-bundle contains the following files

Loading the files please wait ....