installation
Elasticsearch-php There are only three requirements you need to worry about:
- PHP 5.3.9 or later (see more information)
- Composer
- PHP Extensions for Ext-curl:libcurl
Other dependencies are automatically downloaded and installed via composer. Composer is a package that manages PHP dependencies. Installing elasticsearch-php via composer is easy.
version Matrix
Since the Elasticsearch 1.0 version has a sudden change, you need to match the Elasticsearch version to your elasticsearch-php appropriate version. If your Elasticsearch version is older than 1.0, then you need to install the Elasticsearch-php 0.4 branch, otherwise use 1.0 branches.
The master branch always tracks the main branch of Elasticsearch, but does not advocate the use of dev-master branches in your product code.
Elasticsearch Version |
elasticsearch-php Branch |
>= 1.0 |
1.0 |
<= 0.90.* |
0.4 |
Installing composer
- Download and install composer for [linux/unix/osx]https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx or [Windows]https://getcomposer.org/doc/00-intro.md#installation-windows then execute the following command. Composer will download any required dependencies, store them in the/vendor/directory, and generate an autoloader.
[PHP] view plain copy
- PHP composer.phar require Elasticsearch/elasticsearch
- Finally, a production autoloader is introduced into your main project file. If your project is already based on composer, the autoloader may already be included somewhere, and you don't need to add it again. Finally, instantiate a new client:
[PHP] view plain copy
- Require ' vendor/autoload.php ';
- $client = new Elasticsearch\client ();
More information on composer composer.
--no-dev Mark
You will notice some installation commands, especially--no-dev. This can prevent composer from installing some test development dependencies. It is not necessary for the general user to install a test suite. The development dependency, in particular, contains a complete copy of Elasticsearch, which is a fairly large download for developers and testers, so use the--NO-DEV flag.
If you want to contribute to the development of this library, then omit the--no-dev mark on the line.
Source: http://blog.csdn.net/zpf336/article/details/48627789
elasticsearch-php Installation