Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrik nielsen committed May 19, 2014
1 parent c5f30e5 commit 733f61f
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ This bundle allows you to integrate [kraken.io](https://kraken.io/) into your Sy
"pompdelux/kraken-bundle": "1.x"
}
}
2. Use Composer to download and install the bundle:
2. Use Composer to download and install the bundle:

$ php composer.phar update pompdelux/kraken-bundle
3. Register the bundle in your application:

// app/AppKernel.php
class AppKernel extends Kernel
{
Expand All @@ -32,4 +32,57 @@ This bundle allows you to integrate [kraken.io](https://kraken.io/) into your Sy
}
}

4. 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:

```php
$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:

```yml
# 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

```

```php

$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();
}
```

0 comments on commit 733f61f

Please sign in to comment.