PHPackages                             happyr/elastica-dsn - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. happyr/elastica-dsn

ActiveLibrary

happyr/elastica-dsn
===================

DSN support to ruflin/Elastica

0.1.1(6y ago)28894[2 issues](https://github.com/Happyr/elastica-dsn/issues)[2 PRs](https://github.com/Happyr/elastica-dsn/pulls)MITPHPPHP ^7.2CI failing

Since Aug 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Happyr/elastica-dsn)[ Packagist](https://packagist.org/packages/happyr/elastica-dsn)[ RSS](/packages/happyr-elastica-dsn/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (0)

Ruflin Elastica client factory
==============================

[](#ruflin-elastica-client-factory)

[![Latest Version](https://camo.githubusercontent.com/be28ec34396b9edf03dcfb202d218440e8e9f548060fed23c0290291dc6623be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4861707079722f656c6173746963612d64736e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Happyr/elastica-dsn/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/07bedb95499accfed572fd6f12958a3173297391d13b63a74f1b80040ef33cd5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4861707079722f656c6173746963612d64736e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Happyr/elastica-dsn)[![Code Coverage](https://camo.githubusercontent.com/a5e1afff21a9d7c5fce3ca76b52ec5b75b55cf1b79344a7bb4fae1c84f1bb7ff/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f4861707079722f656c6173746963612d64736e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Happyr/elastica-dsn)[![Quality Score](https://camo.githubusercontent.com/08be8bb89c057fc00c5ec7abd8b66a9c138d3f445b83ffdc074dd4d31fe46b6b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4861707079722f656c6173746963612d64736e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Happyr/elastica-dsn)[![Total Downloads](https://camo.githubusercontent.com/2992916613d6977fa0d97460dd7a67a5f92401f6010e99b1f3398aa1d065728b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861707079722f656c6173746963612d64736e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/happyr/elastica-dsn)

This package contains a factory method to create a Elasticsearch client from [ruflin/elastica](https://github.com/ruflin/Elastica). The factory supports DSN to ease config with a dependency injection container.

Install
-------

[](#install)

```
composer require happyr/elastica-dsn

```

Examples
--------

[](#examples)

```
use Happyr\ElasticaDsn\ClientFactory;

$client = ClientFactory::create('elasticsearch://localhost');
$client = ClientFactory::create('elasticsearch:?host[localhost]&host[localhost:9201]&host[127.0.0.1:9202]');
$client = ClientFactory::create('elasticsearch://foo:bar@localhost:1234');
$client = ClientFactory::create('elasticsearch://localhost:9201', ['username' => 'foo', 'password' => 'bar']);
```

If you use Symfony service config:

```
services:
    Elastica\Client:
        factory: 'Happyr\ElasticaDsn\ClientFactory::create'
        arguments: ['elasticsearch://localhost']
```

If you want to configure the client even more, you may just get the config array from the `ClientFactory` and instantiate the client yourself.

```
use Elastica\Client;
use Happyr\ElasticaDsn\ClientFactory;

$config = ClientFactory::getConfig('elasticsearch://localhost');

// Add more stuff to $config array
$client = new Client($config);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~166 days

Total

2

Last Release

2305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (7 commits)")[![carlos-ea](https://avatars.githubusercontent.com/u/5512089?v=4)](https://github.com/carlos-ea "carlos-ea (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/happyr-elastica-dsn/health.svg)

```
[![Health](https://phpackages.com/badges/happyr-elastica-dsn/health.svg)](https://phpackages.com/packages/happyr-elastica-dsn)
```

###  Alternatives

[friendsofsymfony/elastica-bundle

Elasticsearch PHP integration for your Symfony project using Elastica

1.3k17.2M47](/packages/friendsofsymfony-elastica-bundle)[jolicode/elastically

Opinionated Elastica based framework to bootstrap PHP and Elasticsearch implementations.

2571.7M1](/packages/jolicode-elastically)[kunstmaan/bundles-cms

The Kunstmaan CMS is an advanced yet user-friendly content management system, based on the full stack Symfony framework combined with a whole host of community bundles. It provides a full featured, multi-language CMS system with an innovative page and form assembling process, versioning, workflow, translation and media managers and much more.

411285.2k19](/packages/kunstmaan-bundles-cms)[cakephp/elastic-search

An Elastic Search datasource and data mapper for CakePHP

86766.6k8](/packages/cakephp-elastic-search)[kunstmaan/search-bundle

The KunstmaanSearchBundle works with ElasticSearch and supports different search providers. The bundle currently supports Elastica as a provider. Add your own objects to index using a tagged service which implements the SearchConfigurationInterface

1884.8k1](/packages/kunstmaan-search-bundle)[heyday/silverstripe-elastica

Provides Elastic Search integration for SilverStripe DataObjects using Elastica

1136.8k2](/packages/heyday-silverstripe-elastica)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
