PHPackages                             pgs-soft/elastic-om - 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. [Search &amp; Filtering](/categories/search)
4. /
5. pgs-soft/elastic-om

ActiveLibrary[Search &amp; Filtering](/categories/search)

pgs-soft/elastic-om
===================

Elasticsearch Object Mapper

v1.0.0(9y ago)14992[2 issues](https://github.com/PGSSoft/ElasticOM/issues)MITPHPPHP &gt;=7

Since Dec 6Pushed 9y ago4 watchersCompare

[ Source](https://github.com/PGSSoft/ElasticOM)[ Packagist](https://packagist.org/packages/pgs-soft/elastic-om)[ RSS](/packages/pgs-soft-elastic-om/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (11)Versions (2)Used By (0)

[![PGS Software](https://camo.githubusercontent.com/71d1efacf76bc5b062740df1f6e7608fc53f1da961938bab93b3be11da366623/68747470733a2f2f7777772e7067732d736f66742e636f6d2f706773736f66742d6c6f676f2e706e67)](https://www.pgs-soft.com) / ElasticOM
===============================================================================================================================================================================================================================================

[](#--elasticom)

[![Latest Stable Version](https://camo.githubusercontent.com/7eb5229cfbbefdcdc31b209ad1cf4fb6b5c2bfb58f0b068b9155408020a2544c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7067732d736f66742f656c61737469632d6f6d2e737667)](https://packagist.org/packages/pgs-soft/elastic-om)[![PHP Version](https://camo.githubusercontent.com/5c3072425e67297c8ef63d17acd2c86a0d2ef324f19249f2280bd7de902f63a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d3838393242462e737667)](https://php.net)[![License](https://camo.githubusercontent.com/ff8fdc9a0af5a95c4cac02fa7a01209a7511febd02e79c7db230798d0dc0c476/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f504753536f66742f456c61737469634f4d2e737667)](https://packagist.org/packages/pgs-soft/elastic-om)[![Build Status](https://camo.githubusercontent.com/f2e7597e90acc9c3bbe42b3d4e336e1bf98d5b8c57a8a7d64af2c17142f8dad9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f504753536f66742f456c61737469634f4d2f6d61737465722e737667)](https://travis-ci.org/PGSSoft/ElasticOM)[![Code Coverage](https://camo.githubusercontent.com/4350080edbf921ec1885cef4cb26aeb36b2ae4cfa3cfff8c89cdcdbe577850d8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f504753536f66742f456c61737469634f4d2f6d61737465722e737667)](https://scrutinizer-ci.com/g/PGSSoft/ElasticOM/?branch=master)[![Code Quality](https://camo.githubusercontent.com/596bf93b1178be0c0f77d7996617fe88eb6f2fcc8abcd2f15ecb490c575aa9a4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f504753536f66742f456c61737469634f4d2f6d61737465722e737667)](https://scrutinizer-ci.com/g/PGSSoft/ElasticOM/?branch=master)

Elasticsearch Object Mapper. Includes integration with Symfony 2.7+ and Zend Framework 3.

Installation
------------

[](#installation)

```
    composer require pgs-soft/elastic-om
```

Entity type configuration
-------------------------

[](#entity-type-configuration)

Elasticsearch type(s) are configured basing on entities annotations, e.g.

```
    use Pgs\ElasticOM\Annotation as ODM;

    class Book
    {
        /**
         * @var string
         * @ODM\Id
         * @ODM\Field(type="string")
         */
        private $id;

        /**
         * @var Author
         * @ODM\Field(type="nested", targetClass="AppBundle\Entity\Author")
         */
        private $author;

        /**
         * @var string
         * @ODM\Field(type="string")
         */
        private $title;

        // ...
    }
```

Usage
-----

[](#usage)

```
    use Pgs\ElasticOM\ElasticApi\ApiServiceFactory;

    $api = ApiServiceFactory::create('localhost', '9200', 'elastic_om');

    // creating index 'elastic_om'
    $api->createIndex();

    // creating type Book
    $api->createType(Book::class);

    // updating type Book
    $api->updateType(Book::class);
```

### Available annotations

[](#available-annotations)

#### Id

[](#id)

Marks class property to be used as unique object identifier. Only one property can be marked as Id.

#### Field

[](#field)

Specifies property to be mapped into elasticsearch type. Available parameters:

- **type** - elasticsearch mapping type for the property. List of all types can be found here:
- **targetClass** - if type is *object* or *nested*, **targetClass** specifies nested object class

Integrations
------------

[](#integrations)

### Symfony

[](#symfony)

```
    // app/AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            // ...
            new Pgs\ElasticOM\Bridge\Symfony\ElasticOMBundle(),
            // ...
        ];
    }
```

```
    # app/config.yml
    elastic_om:
        host: 'localhost'
        port: 9200
        index: 'elastic_om'
```

```
    $slug = $this->get('elastic_om.entity_repository_manager')
        ->getRepository(Author::class)
        ->update(new Author());
```

### Zend Framework 3

[](#zend-framework-3)

```
    // config/modules.config.php
    return [
        // ...
        'Pgs\ElasticOM\Bridge\ZF3',
    ];
```

```
    // module/Application/config/module.config.php
    'controllers' => [
        'factories' => [
            ExampleController::class => function ($em) {
                return new ExampleController($em->get('elastic_om.entity_repository_manager'));
            },
        ],
    ],
```

```
    // config/module.config.php
    return [
        // ...
        'elastic_om' => [
            'host' => 'localhost',
            'port' => '9200',
            'index' => 'elastic_om',
        ],
        // ...
    ];
```

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on GitHub at .

About
-----

[](#about)

The project maintained by [software development agency](https://www.pgs-soft.com/) [PGS Software](https://www.pgs-soft.com/). See our other [open-source projects](https://github.com/PGSSoft) or [contact us](https://www.pgs-soft.com/contact-us/) to develop your product.

Follow us
---------

[](#follow-us)

[![Twitter URL](https://camo.githubusercontent.com/cb820a0ecc9645168e33b03925d7f14691262ddbaeaf66a0a91697803d0cba2d/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c)](https://twitter.com/intent/tweet?text=https://github.com/PGSSoft/InAppPurchaseButton)[![Twitter Follow](https://camo.githubusercontent.com/57521798958e2fbd8536f96ab43f0b55ef9e7d3529c7ba845ba8594694ac4304/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f706773736f6674776172652e7376673f7374796c653d736f6369616c266c6162656c3d466f6c6c6f77)](https://twitter.com/pgssoftware)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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

Unknown

Total

1

Last Release

3447d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43e5f3c381362868a775f822f2f0bd6d32d77d0226a2d2716e63c65311923ff5?d=identicon)[kubawerlos](/maintainers/kubawerlos)

![](https://www.gravatar.com/avatar/9d129d599d9237602b13dde8e74969f19c77425ee01508edfe54f7a6f5d4587c?d=identicon)[partikus](/maintainers/partikus)

![](https://www.gravatar.com/avatar/55879acfb26db4b5d617aedd6adadc79a706846cea6ffd93eec64a5ab8e0f6d0?d=identicon)[tarnawski](/maintainers/tarnawski)

![](https://www.gravatar.com/avatar/87076a3bbf2cf766d453775096c805c2efef5e0359c1c2bd4c0ebf8f54fc0c71?d=identicon)[kwojtas6](/maintainers/kwojtas6)

![](https://www.gravatar.com/avatar/6ac634322cee0959a70be68ca6a16d7bc80c95e0617083e80169a5520d8226ee?d=identicon)[misieksnk](/maintainers/misieksnk)

---

Top Contributors

[![kubawerlos](https://avatars.githubusercontent.com/u/9282069?v=4)](https://github.com/kubawerlos "kubawerlos (6 commits)")[![tomekziel](https://avatars.githubusercontent.com/u/1764747?v=4)](https://github.com/tomekziel "tomekziel (1 commits)")

---

Tags

phpelasticsearchobject mapper

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/pgs-soft-elastic-om/health.svg)

```
[![Health](https://phpackages.com/badges/pgs-soft-elastic-om/health.svg)](https://phpackages.com/packages/pgs-soft-elastic-om)
```

###  Alternatives

[babenkoivan/elastic-client

The official PHP Elasticsearch client integrated with Laravel

544.0M6](/packages/babenkoivan-elastic-client)

PHPackages © 2026

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