elasticsearch-php Installation

Source: Internet
Author: User
Tags autoloader

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  
  1. 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  
    1. Require ' vendor/autoload.php ';
    2. $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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.