<commit_before># Sajari PHP SDK

[![Packagist](https://img.shields.io/packagist/v/sajari/sajari-sdk-php.svg?style=flat-square)]() ![license](http://img.shields.io/badge/license-MIT-green.svg?style=flat-square)

The Sajari PHP SDK enables use of the Sajari platform from PHP.

We recommend using the [Javascript](https://github.com/sajari/sajari-sdk-js) or [React](https://github.com/sajari/sajari-sdk-react) SDKs if you're serving up search results in a web browser:

- Avoids backend integration.
- Minimises latency by sending queries directly to our servers instead of routing via your infrastructure.
- Provides automatic real-time learning using user interactions and other metrics.

## Table of Contents

* [Setup](#setup)
  * [Prerequisites](#prerequisites)
  * [Adding the SDK to your project](#adding-the-sdk-to-your-project)
  * [Example install on a fresh Ubuntu 16.04](#example-install-on-a-fresh-ubuntu-16.04)
* [Getting Started](#getting-started)
* [Snippets](#snippets)
  * [Performing a text search](#performing-a-text-search)
  * [Getting a record](#getting-a-record)
  * [Deleting a record](#deleting-a-record)
  * [Adding a record](#adding-a-record)
  * [Patching a record](#patching-a-record)
  * [Getting fields from a schema](#getting-fields-from-a-schema)
* [License](#license)

## Setup

### Prerequisites

- Php 5.5+, 7.0+ (requirement from gRPC)
- [Pecl](https://pecl.php.net/)
- [Composer](https://getcomposer.org/) package manager
- [gRPC](https://pecl.php.net/package/gRPC) php extension

### Adding the SDK to your project

Add these sections to your `composer.json` to install the latest version from master.
```
{
  "repositories": [
    {
      "type": "path",
      "url": "https://sajari.github/com/sajari-sdk-php/"
    }
  ],
  "require": {
    "sajari/sajari-sdk-php": "master-dev"
  },
  "minimum-stability": "dev",
  "prefer-stable": true
}
```

### Example install on a fresh Ubuntu 16.04

```bash
sudo apt install php-cli php-dev php-pear
sudo pecl install grpc<commit_msg>Remove broken section of install instructions in readme<commit_after># Sajari PHP SDK

[![Packagist](https://img.shields.io/packagist/v/sajari/sajari-sdk-php.svg?style=flat-square)]() ![license](http://img.shields.io/badge/license-MIT-green.svg?style=flat-square)

The Sajari PHP SDK enables use of the Sajari platform from PHP.

We recommend using the [Javascript](https://github.com/sajari/sajari-sdk-js) or [React](https://github.com/sajari/sajari-sdk-react) SDKs if you're serving up search results in a web browser:

- Avoids backend integration.
- Minimises latency by sending queries directly to our servers instead of routing via your infrastructure.
- Provides automatic real-time learning using user interactions and other metrics.

## Table of Contents

* [Setup](#setup)
  * [Prerequisites](#prerequisites)
  * [Adding the SDK to your project](#adding-the-sdk-to-your-project)
  * [Example install on a fresh Ubuntu 16.04](#example-install-on-a-fresh-ubuntu-16.04)
* [Getting Started](#getting-started)
* [Snippets](#snippets)
  * [Performing a text search](#performing-a-text-search)
  * [Getting a record](#getting-a-record)
  * [Deleting a record](#deleting-a-record)
  * [Adding a record](#adding-a-record)
  * [Patching a record](#patching-a-record)
  * [Getting fields from a schema](#getting-fields-from-a-schema)
* [License](#license)

## Setup

### Prerequisites

- Php 5.5+, 7.0+ (requirement from gRPC)
- [Pecl](https://pecl.php.net/)
- [Composer](https://getcomposer.org/) package manager
- [gRPC](https://pecl.php.net/package/gRPC) php extension

### Adding the SDK to your project

Add these sections to your `composer.json` to install the latest version from master.
```
{
  "require": {
    "sajari/sajari-sdk-php": "master-dev"
  },
  "minimum-stability": "dev",
  "prefer-stable": true
}
```

### Example install on a fresh Ubuntu 16.04

```bash
sudo apt install php-cli php-dev php-pear
sudo pecl install grpc
{'fraction_non_alphanumeric': 0.15174506828528073, 'fraction_numerical': 0.008093070308548306, 'mean_word_length': 4.351826792963464, 'pattern_counts': {'":': 11, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 13, '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': '842395', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1314, 'n_words': 343}