<commit_before># Sajari SDK for PHP

## Quick example

### Search for documents

```php
<?php
require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

// Instantiate an engine client
$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => '1234',
    'secret_key' => '5678',
    'company'    => 'acme',
    'collection' => 'people',
));

// Search the engine for "widgets budgies" and return a maximum of 10 results.
try {
    $results = $c->search(array(
        'q'          => 'widgets budgies',
        'maxresults' => 10,
    ));
    echo var_export($results, true), PHP_EOL;
} catch (EngineException $e) {
    echo "There was an error running the search.", PHP_EOL;
}

```

### Add a document

```php
<?php
require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

// Instantiate an engine client
$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => '1234',
    'secret_key' => '5678',
    'company'    => 'acme',
    'collection' => 'people',
));

// Add a document (person) with the given meta.
try {
    $r = $c->add(array(
        'meta' => array(
            'first_name' => 'Jane',
            'last_name'  => 'Doe',
        ),
    ));
    echo var_export($r, true), PHP_EOL;
} catch (EngineException $e) {
    echo "There was an error adding the document.", PHP_EOL;
}

```
<commit_msg>Add remove example to README<commit_after># Sajari SDK for PHP

## Quick example

### Search for documents

```php
<?php
require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

// Instantiate an engine client
$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => '1234',
    'secret_key' => '5678',
    'company'    => 'acme',
    'collection' => 'people',
));

// Search the engine for "widgets budgies" and return a maximum of 10 results.
try {
    $results = $c->search(array(
        'q'          => 'widgets budgies',
        'maxresults' => 10,
    ));
    echo var_export($results, true), PHP_EOL;
} catch (EngineException $e) {
    echo "There was an error running the search.", PHP_EOL;
}

```

### Add a document

```php
<?php
require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

// Instantiate an engine client
$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => '1234',
    'secret_key' => '5678',
    'company'    => 'acme',
    'collection' => 'people',
));

// Add a document (person) with the given meta.
try {
    $r = $c->add(array(
        'meta' => array(
            'first_name' => 'Jane',
            'last_name'  => 'Doe',
        ),
    ));
    echo var_export($r, true), PHP_EOL;
} catch (EngineException $e) {
    echo "There was an error adding the document.", PHP_EOL;
}

```

### Remove a document

```php
<?php
require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

// Instantiate an engine client
$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => '1234',
    'secret_key' => '5678',
    'company'    => 'acme',
    'collection' => 'people',
));

// Remove the document with document ID "1-1".
try {
    $r = $c->remove(array(
        'id' => '1-1',
    ));
    echo var_export($r, true), PHP_EOL;
} catch (EngineException $e) {
    echo "There was an error removing the document.", PHP_EOL;
}

```

{'fraction_non_alphanumeric': 0.16438746438746438, 'fraction_numerical': 0.014814814814814815, 'mean_word_length': 3.125734430082256, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4951473', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1191, 'n_words': 326}