PHPackages                             gbprod/algolia-specification - 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. gbprod/algolia-specification

AbandonedArchivedLibrary[API Development](/categories/api)

gbprod/algolia-specification
============================

This library allows you to create Algolia queries using the Specification pattern

v2.1.0(8y ago)113.8k1WTFPLPHPPHP ^7.0

Since Sep 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/gbprod/algolia-specification)[ Packagist](https://packagist.org/packages/gbprod/algolia-specification)[ RSS](/packages/gbprod-algolia-specification/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (1)

Algolia specification
=====================

[](#algolia-specification)

[![Build Status](https://camo.githubusercontent.com/c00a620d9df85eb9e891be06e5189cbe0aee3be3fd3cb75e09518fecabddc475/68747470733a2f2f7472617669732d63692e6f72672f676270726f642f616c676f6c69612d73706563696669636174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gbprod/algolia-specification)[![codecov](https://camo.githubusercontent.com/0c22126b231b00f3980f7ecc9d068405bd6aa2c3373f7ead747d7fa4af91f036/68747470733a2f2f636f6465636f762e696f2f67682f676270726f642f616c676f6c69612d73706563696669636174696f6e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/gbprod/algolia-specification)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6c582adebd9e97c78052c87299a0689ee04df2158fdff5bec7324b51e45f2e7c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676270726f642f616c676f6c69612d73706563696669636174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gbprod/algolia-specification/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/e228cee2eea8aa98f419600af1d69ae4f9c02364ebaf8fc4c2296fe1cee0bf4b/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537346139626338636538643065303034313330643333302f62616467652e737667)](https://www.versioneye.com/user/projects/574a9bc8ce8d0e004130d330)

[![Latest Stable Version](https://camo.githubusercontent.com/280ac7dd18aac57c65ff5a67aa40bbb346f3bc4a10ccfbd5735d0dbe9a75429e/68747470733a2f2f706f7365722e707567782e6f72672f676270726f642f616c676f6c69612d73706563696669636174696f6e2f76657273696f6e)](https://packagist.org/packages/gbprod/algolia-specification)[![Total Downloads](https://camo.githubusercontent.com/3749cbaf8e6ca11badc3716ab656c83c812ef88029de635d8f822847cbe96aa4/68747470733a2f2f706f7365722e707567782e6f72672f676270726f642f616c676f6c69612d73706563696669636174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/gbprod/algolia-specification)[![Latest Unstable Version](https://camo.githubusercontent.com/eeb0ca8d3a041c7a7b2d7e519164757d06cdae6926f0c9f047ed9dcf132722dc/68747470733a2f2f706f7365722e707567782e6f72672f676270726f642f616c676f6c69612d73706563696669636174696f6e2f762f756e737461626c65)](https://packagist.org/packages/gbprod/algolia-specification)[![License](https://camo.githubusercontent.com/812c28be3fe55c984544b1716ec25e0155b71834a1beb27b86f9c7bd5eda1ce7/68747470733a2f2f706f7365722e707567782e6f72672f676270726f642f616c676f6c69612d73706563696669636174696f6e2f6c6963656e7365)](https://packagist.org/packages/gbprod/algolia-specification)

This library allows you to create [Algolia](https://www.algolia.com/) queries using the [specification pattern](http://en.wikipedia.org/wiki/Specification_pattern).

Usage
-----

[](#usage)

You can write specifications using [gbprod/specification](https://github.com/gbprod/specification) library.

### Creates a algolia specification filter

[](#creates-a-algolia-specification-filter)

@see [Algolia documentation](https://www.algolia.com/doc/guides/search/filtering-faceting#filtering)

```
namespace GBProd\Acme\Algolia\SpecificationFactory;

use GBProd\AlgoliaSpecification\QueryFactory\Factory;
use GBProd\Specification\Specification;

class IsAvailableFactory implements Factory
{
    public function create(Specification $spec)
    {
        return 'available=1';
    }
}
```

### Configure

[](#configure)

```
$registry = new GBProd\AlgoliaSpecification\Registry();

$handler = new GBProd\AlgoliaSpecification\Handler($registry);
$handler->registerFactory(IsAvailable::class, new IsAvailableFactory());
$handler->registerFactory(StockGreaterThan::class, new StockGreaterThanFactory());
```

### Use it

[](#use-it)

```
$available = new IsAvailable();
$hightStock = new StockGreaterThan(4);

$availableWithLowStock = $available
    ->andX(
        $hightStock->not()
    )
;
$client = new \AlgoliaSearch\Client('YourApplicationID', 'YourAPIKey');
$index = $client->initIndex('index_name');

$query = $handler->handle($availableWithLowStock)

$results = $type->search(['filters' => $query]);
```

Requirements
------------

[](#requirements)

- PHP &gt;= 7.0

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

[](#installation)

### Using composer

[](#using-composer)

```
composer require gbprod/algolia-specification
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~106 days

Recently: every ~60 days

Total

6

Last Release

3047d ago

Major Versions

v0.1.0 → v1.0.02017-06-29

v1.0.x-dev → v2.0.02017-06-29

PHP version history (3 changes)v0.1.0PHP &gt;=5.6

v2.0.0PHP &gt;=7.0

v2.1.0PHP ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3751019?v=4)[gbprod](/maintainers/gbprod)[@gbprod](https://github.com/gbprod)

---

Top Contributors

[![gbprod](https://avatars.githubusercontent.com/u/3751019?v=4)](https://github.com/gbprod "gbprod (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gbprod-algolia-specification/health.svg)

```
[![Health](https://phpackages.com/badges/gbprod-algolia-specification/health.svg)](https://phpackages.com/packages/gbprod-algolia-specification)
```

###  Alternatives

[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[algolia/algoliasearch-magento-2

Algolia Search &amp; Discovery extension for Magento 2

1881.9M18](/packages/algolia-algoliasearch-magento-2)[algolia/search-bundle

Algolia Search integration for Symfony

1941.6M2](/packages/algolia-search-bundle)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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