Download the PHP package covertnija/elasticsearch-integration without Composer

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

Elasticsearch Integration

A Symfony bundle providing an Elasticsearch client with round-robin load balancing, automatic failover, and Kibana-compatible logging.

Features

Requirements

Installation

Step 1: Install the package

Step 2: Register the bundle

With Symfony Flex — done automatically. Flex will:

Without Symfony Flex — add the bundle manually to config/bundles.php:

Step 3: Configure environment variables

Add the following to your .env file (Flex does this automatically):

For multiple hosts, use a comma-separated list:

Step 4: Create the configuration file

If Flex didn't create it, add config/packages/elasticsearch_integration.yaml:

Configuration Reference

Usage

Autowiring the Elasticsearch Client

The client is available via autowiring — just type-hint Client:

Using the Factory for Custom Clients

Inject the factory to create clients with different configurations:

Monolog / Kibana Integration

The bundle registers a LazyElasticsearchHandler that sends logs to Elasticsearch with Kibana-compatible @timestamp fields. The handler:

To use it, reference the bundle's handler service in your monolog config:

If you need a custom service name (e.g. for existing configs), create an alias:

The KibanaCompatibleFormatter renames Monolog's datetime field to @timestamp, which Kibana requires for time-based visualizations.

Architecture

Components

Component Description
RoundRobinHttpClient PSR-18 HTTP client that distributes requests across hosts with automatic failover
ElasticsearchRoundRobinClientFactory Factory that builds Client instances with validated options
ElasticsearchConfig Immutable DTO for typed configuration with host normalization
ElasticsearchExtension Symfony DI extension — registers all services programmatically
KibanaCompatibleFormatter Monolog formatter mapping datetime@timestamp
LazyElasticsearchHandler Monolog handler with deferred initialization and enable/disable support

How Round-Robin Load Balancing Works

  1. The RoundRobinHttpClient rotates through configured hosts on each request
  2. If a host fails (ClientExceptionInterface), the next host is tried automatically
  3. All hosts are attempted before throwing the first exception
  4. The round-robin index persists across requests for even distribution
  5. All operations are logged via the elasticsearch Monolog channel

Available Services

Service ID Class Description
elasticsearch_integration.client Elastic\Elasticsearch\Client Main ES client
elasticsearch_integration.client_factory ElasticsearchRoundRobinClientFactory Client factory
elasticsearch_integration.round_robin_http_client RoundRobinHttpClient Lazy HTTP client with round-robin failover
elasticsearch_integration.kibana_formatter KibanaCompatibleFormatter Monolog formatter
elasticsearch_integration.monolog_handler LazyElasticsearchHandler Monolog handler for ES logging

All services are private and available via autowiring:

Container Parameters

Parameter Type Description
elasticsearch_integration.enabled bool Whether the integration is active
elasticsearch_integration.hosts array<string> Configured host URLs
elasticsearch_integration.index string Default index name
elasticsearch_integration.client_options array Client builder options
elasticsearch_integration.ssl_verification bool Whether SSL certificate verification is enabled

Security note: The API key is not exposed as a container parameter. It is passed directly to the client factory at build time.

Testing

Security

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests (aim for 100% coverage)
  4. Run composer check to verify tests, PHPStan, and code style
  5. Submit a pull request

License

MIT — see LICENSE for details.


All versions of elasticsearch-integration with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
elasticsearch/elasticsearch Version ^9.2
monolog/monolog Version ^3.0
psr/log Version ^3.0
symfony/config Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.0
symfony/http-client Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.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 covertnija/elasticsearch-integration contains the following files

Loading the files please wait ...