phpextra / silex-algolia-provider
This package is abandoned and no longer maintained.
No replacement package was suggested.
Algolia Silex service provider
dev-master
2016-01-05 14:35 UTC
Requires
- php: >=5.5
- algolia/algoliasearch-client-php: ^1.6
Requires (Dev)
- silex/silex: ^1.3
This package is not auto-updated.
Last update: 2022-02-01 12:54:31 UTC
README
This library integrates official Algolia client into Silex.
Algolia is a hosted Search API.
##Installation
Installation is done using Composer:
composer require phpextra/silex-algolia-provider
You can test the library using phpunit
by running the following command (assuming that you have phpunit
command available):
phpunit ./tests
##Usage
###Service registration:
$app = new Application(); $app->register(new AlgoliaSearchServiceProvider()); $app['algolia.application_id'] = 'dummy'; $app['algolia.api_key'] = 'dummy'; $app['algolia.index.name'] = 'dummy'; /* ... */ $app->get(function(Request $request) use ($app){ return new JsonResponse($app['algolia.index']->search($request->get('q'))); });
###Using provided trait:
class MyApplication extends Application { use AlgoliaSearchTrait; public function __construct() { $this->register(new AlgoliaSearchServiceProvider()); parent::__construct(); } } $app = new MyApplication(); /* ... */ $app->algolia(); // gives you access to Algolia Client instance $app->search('query'); // performs search
##Useful links
- Algolia REST API documentation
- Algolia PHP Client documentation & integration instructions
- Algolia on GitHub
##Author
- Jacek Kobus kobus.jacek@gmail.com