2017 © Pedro Peláez
 

library algolia-specification

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

image

gbprod/algolia-specification

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

  • Monday, February 26, 2018
  • by gbprod
  • Repository
  • 2 Watchers
  • 1 Stars
  • 7,436 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 11 % Grown

The README.md

Algolia specification

Build Status codecov Scrutinizer Code Quality Dependency Status, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

This library allows you to create Algolia queries using the specification pattern., (*3)

Usage

You can write specifications using gbprod/specification library., (*4)

Creates a algolia specification filter

@see Algolia documentation, (*5)

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

$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

$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

  • PHP >= 7.0

Installation

Using composer

composer require gbprod/algolia-specification

The Versions

26/02 2018

dev-master

9999999-dev

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

  Sources   Download

MIT WTFPL

The Requires

 

The Development Requires

by Avatar gbprod

26/02 2018

v2.1.0

2.1.0.0

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

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Avatar gbprod

26/02 2018

dev-chore/update-deps

dev-chore/update-deps

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

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Avatar gbprod

22/02 2018

dev-chore/licence

dev-chore/licence

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

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Avatar gbprod

29/06 2017

v2.0.1

2.0.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar gbprod

29/06 2017

v2.0.0

2.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar gbprod

29/06 2017

v1.0.x-dev

1.0.9999999.9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar gbprod

29/06 2017

v1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar gbprod

11/09 2016

v0.1

0.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar gbprod