Basic integration AWS CloudSearch API

Basic integration AWS CloudSearch API


A library to interact with Amazon’s AWS CloudSearch API. Please note that this is a fork of Sander Huijsen’s fork of Mark Wilson’s AwsCloudSearchPhp. You might want to use one of their libraries in stead (see Credits).


  • PHP 5+
  • cURL extension
  • AWS account
  • CloudSearch domain

Getting Started

For detailed instructions, check out Making Amazon CloudSearch API Requests.

curl -s | php
php composer.phar install

Require “raptor404/awscloudsearchphp” in your composer.json:-

    "require": {
        "raptor404/awscloudsearchphp": "dev-master"

Pass your CloudSearch domain and server location to initialise the class:

$loader = require 'vendor/autoload.php';
$cloudSearch = new AwsCloudSearchAwsCloudSearch(<domain>, <server location>);

// search domain's indexed documents
$cloudSearch->setReturnFields(<array of fields in storage>);
$response = $cloudSearch->search(<term>, <additional parameters>);
if ($response->wasSuccessful()) {
else {

// add/update/delete array of documents
$documents = array();
$document = new AwsCloudSearchDocumentAddDocument(<id>, <version>, <lang=en>, <fields array>);
$documents = $document;

$response = $cloudSearch->processDocuments($documents);
if ($response->wasSuccesful()) {
    echo $response;
else {

You can also check out the samples/ directory.

Documents must be formatted to the Search Data Format (SDF).


Forked from AwsCloudSearchPhp which is a for of AwsCloudSearchPhp.


Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *