core23 / shariff-bundle
This bundle provides shariff integration in symfony applications
Fund package maintenance!
core23
Opencollective
Ko-Fi
Other
Installs: 339
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 4
Open Issues: 2
Type:symfony-bundle
Requires
- php: ^7.3
- ext-json: *
- psr/cache: ^1.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
- sonata-project/block-bundle: ^3.21 || ^4.2
- sonata-project/form-extensions: ^1.0
- symfony/config: ^4.2 || ^5.0
- symfony/dependency-injection: ^4.2 || ^5.0
- symfony/expression-language: ^4.2 || ^5.0
- symfony/form: ^4.2 || ^5.0
- symfony/framework-bundle: ^4.2 || ^5.0
- symfony/http-foundation: ^4.2 || ^5.0
- symfony/http-kernel: ^4.2 || ^5.0
- symfony/options-resolver: ^4.2 || ^5.0
- symfony/twig-bundle: ^4.2 || ^5.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.3
- ergebnis/composer-normalize: ^2.0.1
- nyholm/psr7: ^1.0
- symfony/browser-kit: ^4.4 || ^5.0
- symfony/cache: ^4.2 || ^5.0
- symfony/http-client: ^4.2 || ^5.0
- 5.1.1
- 5.1.0
- 5.0.0
- 4.0.0
- 3.4.x-dev
- 3.3.x-dev
- 3.3.0
- 3.2.x-dev
- 3.2.0
- 3.0.1
- 3.0.0
- 2.0.0
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-renovate/phpunit-phpunit-10.x
- dev-dependabot/composer/vendor-bin/tools/symfony/http-kernel-6.0.20
- dev-renovate/eslint-8.x
- dev-renovate/symfony-webpack-encore-4.x
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-renovate/psalm-plugin-symfony-5.x
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-renovate/vimeo-psalm-5.x
- dev-dependabot/composer/vendor-bin/tools/phpstan/phpstan-doctrine-1.2.3
- dev-dependabot/composer/vendor-bin/tools/phpstan/phpstan-symfony-0.12.19
This package is auto-updated.
Last update: 2023-02-26 08:59:40 UTC
README
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 nucleos/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 [ // ... Nucleos\ShariffBundle\NucleosShariffBundle::class => ['all' => true], ];
Define cache, http client and request factory:
# config/routes/nucleos_shariff.yaml
framework:
cache:
pools:
cache.shariff:
adapter: cache.adapter.filesystem
nucleos_shariff:
cache: 'cache.shariff'
http_client: 'some.http.client' # e.g httplug.client
request_factory: 'some.request.factory' # e.g. nyholm.psr7.psr17_factory
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 nucleos_shariff.yaml
:
# config/routes/nucleos_shariff.yaml nucleos_shariff: resource: "@NucleosShariffBundle/Resources/config/routing/backend.yml"
Create a configuration file called framework_cache.yaml
:
framework: cache: pools: cache.shariff: adapter: cache.adapter.filesystem
Usage
{# template.twig #} {{ sonata_block_render({ 'type': 'nucleos_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.
nucleos_shariff: cache: 'cache.shariff' http_client: 'some.http.client' request_factory: 'some.request.factory' options: domains: [ ] # Allow specific domains for shariff services: [ 'addthis', 'buffer', 'facebook', 'pinterest', 'reddit', 'stumbleupon', 'vk', 'xing' ] services: facebook: app_id: "1234567890" secret: "GENERATEDSECRET" version: "5.0"
This is a fork of shariff-php with a more modern and dynamic solution.
License
This bundle is under the MIT license.