emanueleminotto / embedly-service-provider
Embed.ly Service Provider for Silex
1.0.0
2015-02-05 00:25 UTC
Requires
- emanueleminotto/embedly: ~1.1
- silex/silex: ~1
Requires (Dev)
- phpunit/phpunit: ~4.4
- twig/twig: ~1.18
Suggests
- twig/twig: allows Twig extension integration
This package is auto-updated.
Last update: 2024-10-28 07:04:45 UTC
README
An embed.ly service provider for Silex.
API: emanueleminotto.github.io/EmbedlyServiceProvider
Install
Install Silex using Composer.
Install the EmbedlyServiceProvider adding emanueleminotto/embedly-service-provider
to your composer.json or from CLI:
$ composer require emanueleminotto/embedly-service-provider
Usage
Initialize it using register
use EmanueleMinotto\EmbedlyServiceProvider\EmbedlyServiceProvider; $app->register(new EmbedlyServiceProvider(), array( 'embedly.api_key' => 'xxx', // default null, optional 'embedly.twig' => false, // default true, optional ));
From PHP
use Silex\Application; $app->get('/get', function (Application $app) { $url = $app['request']->get('url'); $data = $app['embedly']->oembed([ 'url' => $url, ]); return $app->json($data); });
From Twig
Setting the option embedly.twig => true
, if there's the Twig service provider, you'll be able to use the Twig extension provided by the Embedly library.