PHPackages                             hlquery/php-client - 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. hlquery/php-client

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

hlquery/php-client
==================

PHP client library for hlquery search engine

v1.0.0(3w ago)201[5 issues](https://github.com/hlquery/php-api/issues)BSD-3-ClausePHPPHP &gt;=7.0CI passing

Since Jun 29Pushed 3w agoCompare

[ Source](https://github.com/hlquery/php-api)[ Packagist](https://packagist.org/packages/hlquery/php-client)[ RSS](/packages/hlquery-php-client/feed)WikiDiscussions unstable Synced 3w ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

 [![hlquery logo](https://camo.githubusercontent.com/73df31369b4ebc9930146e062c6cd181663b23eb52c6f13b11214bd7b308bb57/68747470733a2f2f646f63732e686c71756572792e636f6d2f696d672f686c71756572792f322e706e67)](https://camo.githubusercontent.com/73df31369b4ebc9930146e062c6cd181663b23eb52c6f13b11214bd7b308bb57/68747470733a2f2f646f63732e686c71756572792e636f6d2f696d672f686c71756572792f322e706e67)

**A modular PHP client library for hlquery, designed with a familiar and intuitive API structure.**

[![Follow hlquery](https://camo.githubusercontent.com/75cdccbc8f754d8aaec11e587216294b7b76e26986cb5078e69f44f26d89ffe1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f466f6c6c6f772d253430686c71756572792d626c75653f6c6f676f3d78266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://x.com/hlquery)[![PHP build](https://camo.githubusercontent.com/1de442fc066e107464e4cebed3e13911b014aaa1acb3cdec2bab2703b27d3c05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502532306275696c642d70617373696e672d627269676874677265656e3f6c6f676f3d706870266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://github.com/hlquery/php-api/actions/workflows/ci.yml)[![php-api](https://camo.githubusercontent.com/31a9dca793264fa325d56bdf53b25f3d0b4f3d0ddcaea045881b654d7faa7bae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d7068702d2d6170692d707572706c653f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://github.com/hlquery/php-api/)[![hlquery](https://camo.githubusercontent.com/90300358fda5ada7a5b8b284c07fc97c476adb0fe14cd96fd817722c5fe48e23/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d686c71756572792d626c75653f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://github.com/hlquery/hlquery/)[![License](https://camo.githubusercontent.com/c121fb04b6c6b23f6bbb4089ae74a648e4f8a5e512179a816018cc8401ed4203/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d425344253230332d2d436c617573652d6133356130663f6c6f676f3d6f70656e2d736f757263652d696e6974696174697665266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://opensource.org/licenses/BSD-3-Clause)

### What is the hlquery PHP API?

[](#what-is-the-hlquery-php-api)

The hlquery PHP API is the official PHP client for [hlquery](https://github.com/hlquery/hlquery). It gives PHP applications a straightforward way to talk to the search engine through a small client instead of manually assembling `curl` calls and JSON payloads.

The library wraps hlquery's HTTP endpoints in a service-based API so you can create collections, index documents, run searches, manage lexical resources, and call custom module routes from normal PHP code.

### Why use it?

[](#why-use-it)

Use the PHP API when you want hlquery integration to feel like part of your application instead of a pile of hand-written REST calls. It reduces boilerplate, keeps authentication and request formatting consistent, and makes common operations easier to read and maintain.

### Install

[](#install)

Requirements:

- PHP `>= 7.0`
- `ext-curl`
- `ext-json`

Composer:

```
$ composer require hlquery/php-client
```

Local usage:

```
require_once __DIR__ . '/lib/autoload.php';

use Hlquery\Client;
$client = new Client(getenv('HLQ_BASE_URL') ?: (getenv('HLQUERY_BASE_URL') ?: 'http://localhost:9200'));
```

Composer usage:

```
require_once __DIR__ . '/vendor/autoload.php';

use Hlquery\Client;

$client = new Client('http://localhost:9200');
```

### Auth

[](#auth)

```
$client = new Client('http://localhost:9200', [
    'token' => 'your_token_here',
    'auth_method' => 'bearer',
]);

$client->setAuthToken('your_token_here', 'bearer');
$client->setAuthToken('your_api_key_here', 'api-key');
```

### Quick Start

[](#quick-start)

```
require_once __DIR__ . '/vendor/autoload.php';

use Hlquery\Client;

$client = new Client('http://localhost:9200');

$health = $client->health();
if ($health->isSuccess()) {
    echo "status: " . (($health->getBody()['status'] ?? 'ok')) . PHP_EOL;
}

$collections = $client->listCollections(0, 10);
print_r($collections->getBody());
```

### Collections

[](#collections)

List collections with pagination and iterate over the result:

```
$response = $client->listCollections(0, 100);

if (!$response->isSuccess()) {
    throw new RuntimeException('Failed to list collections: ' . $response->getStatusCode());
}

$body = $response->getBody();
$collections = $body['collections'] ?? [];

foreach ($collections as $collection) {
    $name = is_array($collection) ? ($collection['name'] ?? '') : $collection;

    if ($name === '') {
        continue;
    }

    echo $name . PHP_EOL;
}
```

### SQL

[](#sql)

```
$sql = $client->sql();

$rows = $sql->raw('SHOW COLLECTIONS;');
$books = $sql->query(
    'books',
    'SELECT id, title FROM books ORDER BY title ASC LIMIT 3;'
);

print_r($rows->getBody());
print_r($books->getBody());
```

### Reduce Text Example

[](#reduce-text-example)

Use `executeRequest()` to call custom module routes directly:

```
$moduleResponse = $client->executeRequest('GET', '/modules//', null, [
    'q' => 'example query',
]);

print_r($moduleResponse->getBody());
```

### Contributing

[](#contributing)

We welcome contributions from the community! All contributions must be released under the BSD 3-Clause license.

### How to Contribute

[](#how-to-contribute)

- Check existing [PHP API issues](https://github.com/hlquery/php-api/issues) or create new ones
- Contribute PHP client changes to [hlquery/php-api](https://github.com/hlquery/php-api)
- Contribute shared server/API changes to [hlquery/hlquery](https://github.com/hlquery/hlquery)
- Test and report bugs against the PHP client
- Improve PHP-specific documentation and examples

### Community

[](#community)

- [Documentation](https://docs.hlquery.com)
- [X (Twitter)](https://x.com/hlquery)
- [PHP API GitHub](https://github.com/hlquery/php-api)
- [hlquery GitHub](https://github.com/hlquery/hlquery)

### License

[](#license)

The hlquery PHP API is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance74

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

25d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/79171176?v=4)[Carlos Ferry](/maintainers/cferrys)[@cferrys](https://github.com/cferrys)

---

Top Contributors

[![cferrys](https://avatars.githubusercontent.com/u/79171176?v=4)](https://github.com/cferrys "cferrys (47 commits)")

---

Tags

hlqueryphprest-api

### Embed Badge

![Health badge](/badges/hlquery-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/hlquery-php-client/health.svg)](https://phpackages.com/packages/hlquery-php-client)
```

###  Alternatives

[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26193.1k](/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)
