== Installation

Elasticsearch-php only has a three requirements that you need to worry about:

* PHP 5.3.9 or higher (link:_php_version_requirement.html[see here for more details])
* http://getcomposer.org[Composer]
* http://php.net/manual/en/book.curl.php[ext-curl]: the Libcurl extension for PHP

The rest of the dependencies will automatically be downloaded and installed by Composer.  Composer is a package and dependency manager for PHP.  Installing elasticsearch-php with Composer is very easy

=== Version Matrix

Since there are breaking changes in Elasticsearch 1.0, you need to match your version of Elasticsearch to the appropriate version of this library.
If you are using a version older than 1.0, you must install the `0.4` Elasticsearch-PHP branch.  Otherwise, use the `1.0` branch.

The master branch will always track Elasticsearch master, but it is not recommended to use `dev-master` in your production code.

[width="40%",options="header",frame="topbot"]
|============================
|Elasticsearch Version | Elasticsearch-PHP Branch
| >= 1.0                | `1.0`
| <= 0.90.*             | `0.4`
|============================

=== Composer Installation

* Install the client with 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 automatically download any required dependencies, store them in a
`/vendor/` directory and build an autoloader:

+
[source,shell]
--------------------------
php composer.phar require elasticsearch/elasticsearch
--------------------------

* Finally, include the generated autoloader in your main project.  If your project is already based on Composer, the autoloader is likely already included somewhere and you don't need to add it again.  Finally, instantiate a new client:
+
[source,php]
--------------------------
require 'vendor/autoload.php';

$client = new Elasticsearch\Client();
--------------------------

More information about http://getcomposer.org/[Composer can be found at their website].

=== --no-dev flag
You'll notice that the installation command specified `--no-dev`.  This prevents Composer
from installing the various testing and development dependencies.  For average users, there
is no need to install the test suite.  In particular, the development dependencies include
a full copy of Elasticsearch so that tests can be run against the REST specifications  This
is a rather large download for non-developers, hence the --no-dev flag

If you wish to contribute to development of this library, just omit the `--no-dev` flag to
be able to run tests.
