PHPackages                             nevon/swiftype - 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. [Search &amp; Filtering](/categories/search)
4. /
5. nevon/swiftype

AbandonedArchivedLibrary[Search &amp; Filtering](/categories/search)

nevon/swiftype
==============

A PHP client for Swiftype, a search and autocomplete API for developers.

251019PHP

Since Jul 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Nevon/swiftype-php)[ Packagist](https://packagist.org/packages/nevon/swiftype)[ RSS](/packages/nevon-swiftype/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

swiftype-php
============

[](#swiftype-php)

A PHP client for [Elastic Site Search](https://swiftype.com/site-search), a search and autocomplete API for developers.

⚠️ This integration is deprecated and you should use the [official client](https://github.com/swiftype/swiftype-site-search-php) instead.

Example usage
-------------

[](#example-usage)

```
require 'swiftype.php';

$client = new \Swiftype\SwiftypeClient('your@email.com', 'password', 'api_key');

print_r($client->create_engine('library'));

print_r($client->create_document_type('library', 'books'));

print_r($client->create_document('library', 'books', array(
	'external_id' => '1',
	'fields' => array(
		array(
			'name' => 'title',
			'value' => 'The Art of Community',
			'type' => 'string'
		),
		array(
			'name' => 'author',
			'value' => 'Jono Bacon',
			'type' => 'enum'
		)
	)
)));

print_r($client->documents('library', 'books'));
```

### Documentation

[](#documentation)

The library should conform to the documentation found [here](http://swiftype.com/documentation/overview).

#### \_\_construct(\[username String\], \[password String\], \[api\_key String\], \[host String\], \[api\_base\_path String\])

[](#__constructusername-string-password-string-api_key-string-host-string-api_base_path-string)

The constructor for the SwiftypeClient object. Set your authentication information here. You can supply either an API key or a username (email) and password combination.

`$client = new \Swiftype\SwiftypeClient('your@email.com', 'password', 'api_key');`

#### engines()

[](#engines)

Returns all your engines

`$client->engines();`

#### engine(engine\_id String)

[](#engineengine_id-string)

Returns a specific engine.

`$client->engine('library');`

#### create\_engine(engine\_id String)

[](#create_engineengine_id-string)

Creates a new engine

`$client->create_engine('library');`

#### destroy\_engine(engine\_id String)

[](#destroy_engineengine_id-string)

Destroys an engine

`$client->destroy_engine('library');`

#### document\_types(engine\_id String)

[](#document_typesengine_id-string)

Returns a list of all the document types for a certain engine

`$client->document_types('library');`

#### document\_type(engine\_id String, document\_type\_id String)

[](#document_typeengine_id-string-document_type_id-string)

Fetches a specific document\_type.

`$client->document_type('library', 'books');`

#### create\_document\_type(engine\_id String, document\_type\_id String)

[](#create_document_typeengine_id-string-document_type_id-string)

Creates a document type for a specific engine.

`$client->create_document_type('library', 'books');`

#### destroy\_document\_type(engine\_id String, document\_type\_id String)

[](#destroy_document_typeengine_id-string-document_type_id-string)

Destroys a document type.

`$client->destroy_document_type('library', 'books');`

#### documents(engine\_id String, document\_type\_id String)

[](#documentsengine_id-string-document_type_id-string)

Returns all documents for a certain engine and document type.

`$client->documents('library', 'books');`

#### document(engine\_id String, document\_type\_id String, document\_id String)

[](#documentengine_id-string-document_type_id-string-document_id-string)

Returns a specific document.

`$client->document('library', 'books', '1');`

#### create\_document(engine\_id String, document\_type\_id String, document Array)

[](#create_documentengine_id-string-document_type_id-string-document-array)

Creates a document. A document is an associative array containing an `external_id` and a number of `fields`. See \[this\]( field\_types) for more information on fields and types.

```
$client->create_document('library', 'books', array(
    'external_id' => '1',
    'fields' => array(
        array(
            'name' => 'title',
            'value' => 'The Art of Community',
            'type' => 'string'
        ),
        array(
            'name' => 'author',
            'value' => 'Bono Jacon',
            'type' => 'enum'
        )
    )
));
```

#### create\_or\_update\_document(engine\_id String, document\_type\_id String, document Array)

[](#create_or_update_documentengine_id-string-document_type_id-string-document-array)

Same as `create_document`, except it updates an existing document if there is one.

```
$client->create_or_update_document('library', 'books', array(
    'external_id' => '1',
    'fields' => array(
        array(
            'name' => 'author',
            'value' => 'Jono Blargon',
            'type' => 'enum'
        )
    )
));
```

#### update\_document(engine\_id String, document\_type\_id String, document\_id String, fields Array)

[](#update_documentengine_id-string-document_type_id-string-document_id-string-fields-array)

Updates a single document with the specified `document_id`.

```
$client->update_document('library', 'books', '1', array('author' => 'Jorbo Bacon'));
```

#### update\_documents(engine\_id String, document\_type\_id String, documents Array)

[](#update_documentsengine_id-string-document_type_id-string-documents-array)

Batch operation for updating documents. `documents` is simply an array containing arrays of the same type that we supplied to the `create_document`method.

```
$client->update_documents('library', 'books', array(
    array(
        'external_id' => '1',
        'fields' => array(
            'name' => 'author',
            'value' => 'Jono Bacon',
        )
    )
));
```

#### destroy\_document(engine\_id String, document\_type\_id String, document\_id String)

[](#destroy_documentengine_id-string-document_type_id-string-document_id-string)

Destroys a document.

`$client->destroy_document('library', 'books', '1');`

#### destroy\_documents(engine\_id String, document\_type\_id String, document\_ids Array)

[](#destroy_documentsengine_id-string-document_type_id-string-document_ids-array)

Destroy documents in bulk. `document_ids` is a simple array containing the `external_id`s of the documents you wish to destroy.

`$client->destroy_documents('library', 'books', array('1', '2'));`

#### search(engine\_id String, \[document\_type\_id String\], query String, \[options Array\])

[](#searchengine_id-string-document_type_id-string-query-string-options-array)

If you do not supply a `document_type_id`, `search` searches through the specified engine to find a document type that matches the query. If a `document_type_id` **is** supplied, then `search` searches through that particular document type in that engine for a document that matches the query.

To see what options are available, [see the documentation](http://swiftype.com/documentation/searching).

```
$client->search('library', 'books', 'community', array(
    'per_page' => 5
));
```

#### suggest(engine\_id String, query String, \[options Array\])

[](#suggestengine_id-string-query-string-options-array)

Used for autocompletion. [See the documentation](http://swiftype.com/documentation/autocomplete) for more information.

```
$client->suggest('library', 'Bacon', array(
    'search_fields' => 'author'
));
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.5% 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://avatars.githubusercontent.com/u/83586?v=4)[Tommy Brunn](/maintainers/Nevon)[@Nevon](https://github.com/Nevon)

---

Top Contributors

[![Nevon](https://avatars.githubusercontent.com/u/83586?v=4)](https://github.com/Nevon "Nevon (25 commits)")[![jeshuaborges](https://avatars.githubusercontent.com/u/13011?v=4)](https://github.com/jeshuaborges "jeshuaborges (3 commits)")[![afoucret](https://avatars.githubusercontent.com/u/529238?v=4)](https://github.com/afoucret "afoucret (2 commits)")[![mriley](https://avatars.githubusercontent.com/u/28009?v=4)](https://github.com/mriley "mriley (2 commits)")[![mikhuang](https://avatars.githubusercontent.com/u/206310?v=4)](https://github.com/mikhuang "mikhuang (1 commits)")[![qhoxie](https://avatars.githubusercontent.com/u/13416?v=4)](https://github.com/qhoxie "qhoxie (1 commits)")

### Embed Badge

![Health badge](/badges/nevon-swiftype/health.svg)

```
[![Health](https://phpackages.com/badges/nevon-swiftype/health.svg)](https://phpackages.com/packages/nevon-swiftype)
```

###  Alternatives

[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26190.2k](/packages/awesome-nova-dependent-filter)[algolia/php-dom-parser

A simple tool to turn DOM into Algolia search friendly record objects.

181.8k](/packages/algolia-php-dom-parser)

PHPackages © 2026

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