Download the PHP package andsalves/doctrine-elastic without Composer

On this page you can find all versions of the php package andsalves/doctrine-elastic. 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 doctrine-elastic

Doctrine-Elastic

Custom Doctrine Library for Elasticsearch.

Build Status Coverage Status Scrutinizer Code Quality

Last stable release: v1.3.1 (Elasticsearch 2.x or 5.x support)

Tests on Elasticsearch 2.4.1/5.1/5.5 - PHP 5.6/7.0

This library is not actively maintained anymore

Get Started

Creating a working ElasticEntityManager

Please see https://github.com/andsalves/doctrine-elastic/blob/master/docs/creating-an-elastic-entity-manager-instance.md

Creating a working DoctrineElastic Entity

Just like Doctrine, we need to set some annotations in our entities, here's an example:

This entity represents, in Elasticsearch, a type named 'foo_type', that belongs to an index named 'foo_index'. Note the class annotation @ElasticORM\Type with these definitions. The property annotation @ElasticORM\Field represents a _source field of a document inside the 'foo_type' type. The @ElasticORM\MetaField annotation represents a metafield, like _id. @ElasticORM\MetaField _id is required for an entity, and must be a public property.

Only properties with @ElasticORM\Field annotation will be considered document fields. In elasticsearch, the document column name will be the 'name' property from @ElasticORM\Field annotation from the class property, just like the 'type' annotation property.

Inserting Documents

With this library, making CRUD operations through ElasticEntityManager is really simple. Assuming you have an ElasticEntityManager instance in a variable called $elasticEntityManager:

Note 1:

Index and type will be created automatically, as well as their mappings, if don't exist yet.

Note 2:

By default, mappings for analyzable fields will be not_analyzed (index='not_analyzed'). DoctrineElastic was made to work this way. However, you can change it with 'index' @ElasticORM\Field annotation property, if you prefer default analized fields. e.g. @ElasticORM\Field(name='mad_field', type='string', index='analyzed'). Attention: Search documents with ElasticEntityManager is not guaranteed when you do that, once it isn't always possible to match exact values.

Note 3:

DoctrineElastic does not accept TRANSACTIONS (yet). You will find an available 'beginTransaction' method in ElasticEntityManager, but it does nothing. It is there because ElasticEntityManager implements EntityManagerInterface from Doctrine. That happens with some few other methods.

Note 4:

Just like in Doctrine, after flushing, the entity will have the _id field filled. If you persist an entity with _id field non null, DoctrineElastic will search a doc for update, if it doesn't exist, it's created with the provided _id.

Finding Documents

If you know Doctrine, this is very easy and intuitive:

Note 1:

You can use findBy and findAll methods too.

Note 2:

It doesn't matter if index and type exist or not in your Elasticsearch. If not exist, no documents are returned, also no exception is thrown.

Note 3:

To search by _id, use $elasticEntityManager::getReference or $elasticEntityManager::find (they are equivalent in ElasticEntityManager).

Removing Documents

Using Query Builder

Please see the tests for this feature as a good example: https://github.com/andsalves/doctrine-elastic/blob/master/tests/DoctrineElastic/Tests/ElasticEntityManagerTest.php

Parent-Child Relationship

Please see the tests for this feature as a good example: https://github.com/andsalves/doctrine-elastic/blob/master/tests/DoctrineElastic/Tests/ParentChildTest.php

Application-side Relationships with DoctrineElastic

You can simulate relational databases relationships, with loss of performance, obviously. DoctrineElastic has this feature as an internal feature development, but it is not recommended to be used - if you need complex relationships, you should use a relational database. If you'd really like to use relationships like that with this library, contact me for help.

# #

For questions, please contact me at [email protected].
Please feel free to open issues or make pull requests.

# # # #


All versions of doctrine-elastic with dependencies

PHP Build Version
Package Version
Requires doctrine/orm Version ^2.5
satooshi/php-coveralls Version 1.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 andsalves/doctrine-elastic contains the following files

Loading the files please wait ....