1、新建一个文件夹取名为elasticSearch
2、创建一个名为composer.json的文件,内容
1 { 2 "require": { 3 "elasticsearch/elasticsearch": "~5.1.1" 4 } 5 }
3、下载安装Composer
curl -s http://getcomposer.org/installer | php
4、安装elasticsearch-php
php composer.phar install --no-dev
5、demo
1 <?php 2 3 use ElasticsearchClientBuilder; 4 5 require 'vendor/autoload.php'; 6 7 $client = ClientBuilder::create()->build();