PHPackages                             eliot-az/php-azure-search - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. eliot-az/php-azure-search

ActiveLibrary[API Development](/categories/api)

eliot-az/php-azure-search
=========================

A simple PHP Class to communicate with the Microsoft Azure Search REST API test

1292PHP

Since Jan 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Eliot-az/azure-search-php)[ Packagist](https://packagist.org/packages/eliot-az/php-azure-search)[ RSS](/packages/eliot-az-php-azure-search/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Microsoft Azure Search Service for php
======================================

[](#microsoft-azure-search-service-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/17b5e14315fc459122f5bd8ea35a2bd6024142a6f6ccec2f04a772b33f0bef2b/68747470733a2f2f706f7365722e707567782e6f72672f62656e6a616d696e6869727363682f7068702d617a7572652d7365617263682f762f737461626c65)](https://packagist.org/packages/benjaminhirsch/php-azure-search)[![Build Status](https://camo.githubusercontent.com/fed5b20bfde13e16176a6c8ff588fc63ac64b6b12ee3dd51190602d37d502b9e/68747470733a2f2f62656e6a616d696e6869727363682e76697375616c73747564696f2e636f6d2f617a7572652d7365617263682d7068702f5f617069732f6275696c642f7374617475732f62656e6a616d696e6869727363682e617a7572652d7365617263682d706870)](https://benjaminhirsch.visualstudio.com/azure-search-php/_build/latest?definitionId=1)[![Build Status](https://camo.githubusercontent.com/24d5d4bd75d75672de17c9ec1a0376087fb3954ce7a4fe8ee2ab68043ca1223f/68747470733a2f2f7472617669732d63692e636f6d2f62656e6a616d696e6869727363682f617a7572652d7365617263682d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/benjaminhirsch/azure-search-php)[![Coverage Status](https://camo.githubusercontent.com/212baf2d7b826e8905e11a76516a72e183bc191d8ee00d0d2618b65e34a772e0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62656e6a616d696e6869727363682f617a7572652d7365617263682d7068702f62616467652e7376673f6272616e63683d6d617374657226743d31)](https://coveralls.io/github/benjaminhirsch/azure-search-php?branch=master)[![License](https://camo.githubusercontent.com/fd5ad01b333e812b852f21c06b1a9fa8e61429e2abedbc313aa04821303f6ee7/68747470733a2f2f706f7365722e707567782e6f72672f62656e6a616d696e6869727363682f7068702d617a7572652d7365617263682f6c6963656e7365)](https://packagist.org/packages/benjaminhirsch/php-azure-search)

`benjaminhirsch/php-azure-search` is a simple php toolbox to interact with the Microsoft Azure Search Service REST API.

**Features:**

- Create, update and delete indexes including suggesters and corsOptions
- Create, update and delete all type of fields including collections
- List indexes
- Get index statistics
- Add, update and delete documents
- Search documents
- Get live suggestions
- Count documents

**Upcomming Features**

- Add scoring profiles

Installation
------------

[](#installation)

The easiest way to get started is to install `benjaminhirsch/php-azure-search` via composer.

```
$ composer require benjaminhirsch/php-azure-search
```

---

### Initalize

[](#initalize)

You get your credentials `$azure_url`, `$azure_admin_key` and `$azure_version` in your Microsoft Azure portal under "Search Services".

```
$azuresearch = new BenjaminHirsch\Azure\Search\Service(azure_url, azure_admin_key, azure_version);
```

### Create a Index

[](#create-a-index)

At first you have to create a index `BenjaminHirsch\Azure\Search\Index` in which you have to store your documents later. Your index can be filled with as many fields as you want. Adding a suggester is optional but required if you want to use live search (suggestions).

```
$index = new BenjaminHirsch\Azure\Search\Index('name of your index');
$index->addField(new BenjaminHirsch\Azure\Search\Index\Field('field name 1', BenjaminHirsch\Azure\Search\Index\Field::TYPE_STRING, true))
       ->addField(new BenjaminHirsch\Azure\Search\Index\Field('field name 2', BenjaminHirsch\Azure\Search\Index\Field::TYPE_STRING))
       ->addSuggesters(new BenjaminHirsch\Azure\Search\Index\Suggest('livesearch', ['field name(s)']));

$azuresearch->createIndex($index);
```

### Delete a index

[](#delete-a-index)

Deletes the complete index from Azure. Deleting a index also deletes the documents stored in the index.

```
$azuresearch->deleteIndex('name of the index to delete');
```

### Upload documents

[](#upload-documents)

After you have created a index, you are ready to fill the index with your data. Maximum array size per request (1000).

```
$data['value'][] = [
    '@search.action' => BenjaminHirsch\Azure\Search\Index::ACTION_UPLOAD,
    'field name 1' => ,
    'field name 2' =>
];

$azuresearch->uploadToIndex('name of your index', $data);
```

### Live search (suggestions)

[](#live-search-suggestions)

```
$azuresearch->suggestions('name of your index', 'your term', 'livesearch')
```

### Search documents

[](#search-documents)

```
$azuresearch->search('name of your index', 'your term');
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 81.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c33f51ba44cc31a64a757235b5bf8c6e6126ecb4127611394ab6db26cbb7cd1?d=identicon)[Eliot-az](/maintainers/Eliot-az)

---

Top Contributors

[![benjaminhirsch](https://avatars.githubusercontent.com/u/2293943?v=4)](https://github.com/benjaminhirsch "benjaminhirsch (36 commits)")[![Eliot-az](https://avatars.githubusercontent.com/u/107464519?v=4)](https://github.com/Eliot-az "Eliot-az (6 commits)")[![azure-pipelines[bot]](https://avatars.githubusercontent.com/in/9426?v=4)](https://github.com/azure-pipelines[bot] "azure-pipelines[bot] (1 commits)")[![davidohlin](https://avatars.githubusercontent.com/u/864179?v=4)](https://github.com/davidohlin "davidohlin (1 commits)")

### Embed Badge

![Health badge](/badges/eliot-az-php-azure-search/health.svg)

```
[![Health](https://phpackages.com/badges/eliot-az-php-azure-search/health.svg)](https://phpackages.com/packages/eliot-az-php-azure-search)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
