pompdelux / kraken-bundle
Integrates Kraken.io into your Symfony2 application
Installs: 181
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- misd/guzzle-bundle: 1.x
This package is not auto-updated.
Last update: 2024-11-23 17:17:13 UTC
README
This bundle allows you to integrate kraken.io into your Symfony2 application.
Install:
-
Add KrakenBundle to your dependencies:
// composer.json { // ... "require": { // ... "pompdelux/kraken-bundle": "1.x" } }
-
Use Composer to download and install the bundle:
$ php composer.phar update pompdelux/kraken-bundle
-
Register the bundle in your application:
// app/AppKernel.php class AppKernel extends Kernel { // ... public function registerBundles() { $bundles = array( // ... new Pompdelux\KrakenBundle\KrakenBundle() ); } }
-
Add the configuration needed to use the bundle:
// config.yml kraken: services: service_name: api_key: your-kraken.io-key api_secret: your-kraken.io-secret
Usage:
Basic example:
$kraken = $this->container->get('pompdelux.kraken.service_name'); $result = $kraken->squeeze('http://example.com/some/public/image.jpg');
Example with callback rather than wait strategy:
# config.yml kraken: services: ... callback_service: api_key: your-kraken.io-key api_secret: your-kraken.io-secret callback: true callback_route: your_callback_route # routing.yml acme_kraken_callback: pattern: /my/kraken/callback defaults: { _controller: AcmeTestBundle:Kraken:callback } requirements: _method: POST
$kraken = $this->container->get('pompdelux.kraken.callback_service'); $result = $kraken->squeeze('http://example.com/some/public/image.jpg'); // In AcmeTestBundle/Controller/KrakenController.php // // this method will be called once kraken.io is done processing your image. public function callbackAction(Request $request) { error_log(print_r($request->getContent(), 1)); return new Response(); }