What is ShariffBundle?
This bundle provides a wrapper for using shariff inside the symfony sonata-project.
Installation
php composer.phar require core23/shariff-bundle
Enabling the bundle
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Core23\ShariffBundle\Core23ShariffBundle(),
// ...
);
}
# app/config/routing.yml
core23_shariff:
resource: "@Core23ShariffBundle/Resources/config/routing/backend.yml"
Usage
{# template.twig #}
{{ sonata_block_render({ 'type': 'core23_shariff.block.share' }, {
'url': 'https://example.com/site.html'
}) }}
Configuration
You can globally configure the services that should count the likes or favorites for a page.
doctrine_cache:
providers:
core23_shariff:
type: php_file
namespace: core23_shariff
core23_shariff:
options:
domains: [ ] # Allow specific domains for shariff
services: [ 'GooglePlus', 'Facebook', 'LinkedIn', 'Reddit', 'StumbleUpon', 'Flattr', 'Pinterest', 'Xing', 'AddThis' ]
services:
# Optional configuration when using facebook service
facebook:
app_id: 1234567890
secret: GENERATEDSECRET
Add the block to the sonata_block
configuration if necessary:
sonata_block:
blocks:
...
core23_shariff.block.share: ~
See shariff-php for a list of all available services.
This bundle is available under the MIT license.