PHP code example of gbprod / algolia-specification
1. Go to this page and download the library: Download gbprod/algolia-specification library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gbprod / algolia-specification example snippets
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';
}
}
$registry = new GBProd\AlgoliaSpecification\Registry();
$handler = new GBProd\AlgoliaSpecification\Handler($registry);
$handler->registerFactory(IsAvailable::class, new IsAvailableFactory());
$handler->registerFactory(StockGreaterThan::class, new StockGreaterThanFactory());