Skip to content
This bundle provides a wrapper for using shariff inside the sonata-project.
PHP HTML Makefile JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
assets
src
tests
vendor-bin
.editorconfig
.gitattributes
.gitignore
.kodiak.toml
.php_cs.dist
.rmt.yml
.travis.yml
CHANGELOG
LICENSE.md
Makefile
README.md
composer.json
package.json
phpstan.neon.dist
phpunit.xml.dist

README.md

ShariffBundle

Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

Build Status Scrutinizer Code Quality Code Climate Coverage Status

This bundle provides a wrapper for using shariff inside the symfony sonata-project.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

composer require core23/shariff-bundle

Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Core23\ShariffBundle\Core23ShariffBundle::class => ['all' => true],
];

Assets

It is recommended to use webpack / webpack-encore to include the shariff.js and shariff.css file in your page.

You can use npm or yarn to load the library:

npm install shariff
yarn add shariff

Configure the Bundle

Create a configuration file called core23_shariff.yaml:

# config/routes/core23_shariff.yaml

core23_shariff:
    resource: "@Core23ShariffBundle/Resources/config/routing/backend.yml"

Add the block to the sonata_block configuration if necessary:

# config/packages/sonata_block.yaml

sonata_block:
    blocks:
        core23_shariff.block.share: ~

Create a configuration file called doctrine_cache.yaml:

doctrine_cache:
    providers:
        core23_shariff:
            type: php_file
            namespace: core23_shariff

Usage

{# template.twig #}

{{ sonata_block_render({ 'type': 'core23_shariff.block.share' }, {
    'url': 'https://example.com/site.html'
}) }}

Configure the Bundle

You can globally configure the services that should count the likes or favorites for a page.

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"

See shariff-php for a list of all available services.

License

This bundle is under the MIT license.

You can’t perform that action at this time.