PHPackages                             yucadoo/elasticsearcher-fractal - 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. yucadoo/elasticsearcher-fractal

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

yucadoo/elasticsearcher-fractal
===============================

Combines Elasticsearcher with PHP League's Fractal package for easier document management.

1.0.0(5y ago)34MITPHPPHP ~7.2

Since Jul 31Pushed 5y agoCompare

[ Source](https://github.com/yucadoo/elasticsearcher-fractal)[ Packagist](https://packagist.org/packages/yucadoo/elasticsearcher-fractal)[ Docs](https://github.com/yucadoo/elasticsearcher-fractal)[ RSS](/packages/yucadoo-elasticsearcher-fractal/feed)WikiDiscussions master Synced yesterday

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

ElasticSearcher Fractal
=======================

[](#elasticsearcher-fractal)

[![Latest Version on Packagist](https://camo.githubusercontent.com/be4d62e8a2b2499f5f661f96d603d0e1c470352cd4afe3b64311c61a11dd5185/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79756361646f6f2f656c617374696373656172636865722d6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/elasticsearcher-fractal)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c4dcfc6169e94113e28e3f78751e3fb00d943c42cb9747621301471051e8bf76/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f79756361646f6f2f656c617374696373656172636865722d6672616374616c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yucadoo/elasticsearcher-fractal)[![Coverage Status](https://camo.githubusercontent.com/3ada760eb1e2180d0e9c7f31565ed3b487c340e3ddeed29f7a3f9f06959a9a72/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f79756361646f6f2f656c617374696373656172636865722d6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/elasticsearcher-fractal/code-structure)[![Quality Score](https://camo.githubusercontent.com/f0c996f879f69bc68da3191e27aee9149bb1e69b96b36ec70debd6116afc737b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f79756361646f6f2f656c617374696373656172636865722d6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/elasticsearcher-fractal)[![Total Downloads](https://camo.githubusercontent.com/20ec3769c3a49a707d09a1f16b96f7da68bebe0cbf445b0ae80ac917802dd82a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79756361646f6f2f656c617374696373656172636865722d6672616374616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/elasticsearcher-fractal)

Combines [Elasticsearcher](https://github.com/madewithlove/elasticsearcher) with PHP League's [Fractal package](https://github.com/thephpleague/fractal) for easier document management.

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) and [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md). If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
$ composer require yucadoo/elasticsearcher-fractal
```

Usage
-----

[](#usage)

This package provides the `YucaDoo\ElasticSearcher\Managers\DocumentManager` class which can be used instead of the original `ElasticSearcher\Managers\DocumentsManager` class. It actually wraps the original manager, providing the same functionality in a more reusable and object friendly way.

The original document manager handles raw documents, which are arrays. You always have to specify the Elasticsearch index name and id alongside the document. The new document manager is capable of taking any type of input, for example database models. The Elasticsearch index name and id are determined by the given input, while PHP League's [Fractal package](https://github.com/thephpleague/fractal) is used to convert the input to a document. If you like what you see below, this package is what you were looking for!

```
