nomaya/social-bundle
NomayaSocialBundle is a Symfony bundle that adds social media buttons and share links to Twig templates through simple helpers, covering platforms like Facebook, Twitter, Google+, and Pinterest with minimal configuration.
This is a Symfony bundle, not a Laravel package. There is no service provider or Blade integration; you either adopt the Symfony side of your stack or port the helper logic manually. Given the 13 stars and stale commit history, treat it as a reference implementation rather than a dependency you build a product on.
First steps (Symfony 2/3 era):
composer require nomaya/social-bundleapp/AppKernel.php:
new Nomaya\SocialButtonsBundle\NomayaSocialButtonsBundle(),
app/config/config.yml:
nomaya_social:
buttons:
facebook:
locale: "en_US"
layout: "button_count"
twitter:
locale: "en"
message: "Check this out"
{{ facebookButton(app.request.uri) }}
{{ twitterButton(app.request.uri) }}
Where to look first:
DependencyInjection/Configuration.php — the authoritative list of config keys per network; the README lags behind it.Helper/SocialButtonsHelper.php — the actual markup generation. This is the file you will fork if you move to Laravel.Resources/views/ — the button templates you can override.Resources/config/services.yml — confirms the Twig extension and helper service IDs.First real use case: a reusable _share.html.twig partial included at the bottom of an article template, passing app.request.uri so each post shares its own canonical URL rather than the configured default.
For Laravel: copy the helper's get*Button() methods into a small SocialButtons class, bind it as a singleton, and expose it via a Blade directive or @include partial. The generated markup is just iframes/<div>s, so framework portability is trivial — the value is in the parameter handling.
Config defaults vs. per-call overrides. Set sensible defaults in config, then override the URL at render time so the same helper works for every page:
{{ facebookButton(absolute_url(path('article_show', {slug: article.slug}))) }}
The helper accepts an optional URL argument; if omitted it falls back to nomaya_social.buttons.facebook.url. Use the explicit form almost always.
One partial, many layouts. Wrap all networks in a single partial and include it from your base layout. This centralises CSS, CSP nonces, and consent gating:
{# templates/_social_share.html.twig #}
<div class="social-share" data-consent="marketing">
{{ facebookButton(url) }}
{{ twitterButton(url, message) }}
{{ linkedinButton(url) }}
{{ googleplusButton(url) }}
</div>
Locale per request. Override locale in the button call or via a request listener that rewrites nomaya_social.buttons.*.locale from app.request.locale. Network locales don't map 1:1 to Symfony locales — fr works for Twitter, fr_FR for Facebook/LinkedIn.
Template overrides. Symfony 2/3: copy Resources/views/*.html.twig into app/Resources/NomayaSocialButtonsBundle/views/. Symfony 4+: templates/bundles/NomayaSocialButtonsBundle/. This is the supported extension point; there's no event system worth using.
Progressive enhancement / consent. The iframes load third-party JS immediately. For GDPR you'll either gate the partial behind a consent cookie (render a placeholder until opted in) or swap the helper for a two-click solution. Do not rely on the bundle for this.
Laravel integration sketch. Extract getFacebookButton(), getTwitterButton(), etc. into app/Support/SocialButtons.php, inject config via config('services.social.*'), and register a Blade directive:
Blade::directive('facebookButton', fn ($url) => "<?php echo app(\\App\\Support\\SocialButtons::class)->facebook($url); ?>");
config/social.php, no @facebookButton out of the box. Budget an hour for the port, or pick a maintained alternative (laravel-share, spatie/laravel-social-share style packages) if you're staying in Laravel.--ignore-platform-reqs or a fork. Pin the commit hash if you vendor it.frame-src / script-src allowances. Check the browser console first when a button renders blank.app.request.uri includes query strings and can leak tracking params into share links. Prefer a canonical URL (absolute_url(path(...)) or a canonical variable).vertical-align: top.bin/console debug:config nomaya_social to confirm merge order. In older versions, dump the container (debug:container nomaya_social_buttons.helper) — misregistered bundles cause "unknown parameter" errors at render time, not boot time.og:image, the button is useless; skip it or pass an explicit image URL.How can I help you explore Laravel packages today?