Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Share Buttons Bundle Laravel Package

ezsystems/share-buttons-bundle

Symfony bundle that adds social share buttons (Facebook Like/Recommend, Twitter, LinkedIn, Google+, Xing) to applications, including eZ Publish 5.x and eZ Platform. Install via Composer, enable in the kernel, and configure providers per siteaccess in config.yml with default or custom templates.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Confirm the target stack first. This bundle targets Symfony 2.6+ and eZ Publish 5.x / eZ Platform applications from the pre-Symfony 4 era. It is archived and last released in 2018, so treat it as a legacy integration rather than something to introduce into a modern Symfony application.

  2. Install with a pinned version and commit the lock file.

    composer require ezsystems/share-buttons-bundle
    

    Because the package is archived, pin the resolved version in composer.lock and avoid broad version constraints that could pull in an incompatible release.

  3. Register the bundle.

    For a standard Symfony application, add it to app/AppKernel.php:

    $bundles = array(
        // existing bundles
        new EzSystems\ShareButtonsBundle\EzSystemsShareButtonsBundle(),
    );
    

    For eZ Publish / eZ Platform, add it to ezpublish/EzPublishKernel.php instead.

  4. Install and include the default CSS.

    The README uses Assetic-style asset inclusion:

    {% stylesheets
        bundles/ezsystemssharebuttonsbundle/css/default.css
    %}
        <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
    {% endstylesheets %}
    

    Run the appropriate asset install command for your stack, for example:

    php app/console assets:install --symlink
    # or, depending on your eZ version:
    php app/console ezplatform:assets:install
    
  5. Configure enabled providers per siteaccess.

    The configuration is siteaccess-aware. Start with default and override only where needed:

    ez_share_buttons:
        system:
            default:
                providers:
                    facebook: true
                    twitter: true
                    linkedin: true
    

    Check the bundle's Resources/config directory for the exact provider keys and option shape in your installed version.

  6. Use the Twig helper in a content view.

    The first practical use case is a full content detail page. Add the helper below the content body:

    {{ ez_share_buttons(content) }}
    

    Depending on the bundle version, the function may also accept an explicit provider list or options array. Inspect vendor/ezsystems/share-buttons-bundle/Twig/ if the signature differs from the README.

Implementation Patterns

Centralize share buttons in a reusable partial

Avoid scattering the helper across templates. Create a partial such as app/Resources/views/parts/share_buttons.html.twig:

{% if content is defined and content is not null %}
    <div class="share-buttons">
        {{ ez_share_buttons(content) }}
    </div>
{% endif %}

Then include it from full content views:

{% include 'parts/share_buttons.html.twig' with { content: content } %}

This gives you one place to add consent banners, wrappers, headings, or site-specific markup.

Use siteaccess configuration for a provider matrix

The main day-to-day benefit of this bundle is per-siteaccess control. For a multi-site installation, keep a conservative default and enable extra networks only on relevant sites:

ez_share_buttons:
    system:
        default:
            providers:
                facebook: true
                twitter: true
                linkedin: true
        corporate:
            providers:
                facebook: true
                linkedin: true
        editorial:
            providers:
                facebook: true
                twitter: true
                linkedin: true

Clear caches after changing siteaccess configuration:

php app/console cache:clear --env=prod

Override the default templates rather than editing vendor files

Copy the bundle templates into your application's override path and modify them there. Typical Symfony 2/3 override location:

app/Resources/EzSystemsShareButtonsBundle/views/

Look first at:

vendor/ezsystems/share-buttons-bundle/Resources/views/

The main share-buttons template controls the wrapper and loop; provider-specific templates control individual button markup. Override the smallest template possible.

Replace the default stylesheet with site CSS

The bundled CSS is minimal. In most real projects you should either:

  • Include the default CSS and override classes in your theme, or
  • Omit the bundle stylesheet and style the rendered markup directly.

For modern asset handling, if Assetic is not configured, use a normal asset path instead:

<link rel="stylesheet" href="{{ asset('bundles/ezsystemssharebuttonsbundle/css/default.css') }}">

Add a custom provider when needed

If the bundled providers do not cover a network, inspect the bundle's provider interface and service configuration. The pattern is typically:

  1. Implement the bundle's provider interface.
  2. Register the provider as a service.
  3. Tag it with the provider tag used by the bundle's compiler pass or service config.
  4. Provide a template for the button markup.
  5. Enable it through ez_share_buttons.system.<siteaccess>.providers.

Start by reading Resources/config/services.yml and the existing provider classes. That reveals the exact interface methods, service tag, and template naming convention for your installed version.

Use it as an eZ-content helper, not a generic URL helper

The bundle is designed around eZ content/location objects. If you need share buttons for non-content pages, such as a landing page or custom route, do not force the eZ helper. Either:

  • Render the provider templates directly with an explicit canonical URL and title, or
  • Add a small Twig partial with hard-coded share links for those pages.

This keeps the eZ dependency out of unrelated templates.

Gotchas and Tips

  • Archived status is the biggest risk. There are no upstream fixes for newer Symfony, PHP, or Twig versions. Old bundles often use Twig_SimpleFunction, Assetic tags, and Symfony 2/3 service definitions. Do not assume compatibility with Symfony 4/5/6, PHP 8, or Twig 2/3 without testing or forking.

  • License is marked NOASSERTION. Before shipping, inspect the LICENSE file in the package and confirm it with legal or your open-source policy. Do not rely on the Composer metadata alone.

  • Configuration is siteaccess-scoped. ez_share_buttons.system.default is inherited, but siteaccess-specific blocks override it. If buttons do not appear on one site, check that siteaccess key first, then clear caches.

  • Provider keys must match the bundle's expected identifiers. A typo in facebook, twitter, linkedin, etc. may silently produce no button or throw a configuration error depending on version. Compare against the bundle's configuration class.

  • Assetic is fragile in legacy stacks. If {% stylesheets %} fails, check that AsseticBundle is installed and configured, or bypass it with asset() after running assets:install. Do not mix both approaches without understanding which one publishes the file.

  • Share URLs should be absolute and canonical. Relative URLs, preview URLs, or internal hostnames will produce broken shares. Verify with the rendered HTML and test one share link per provider. On eZ sites, ensure the URL is generated for the correct siteaccess host.

  • Template overrides can be cached aggressively. After copying templates into app/Resources, clear the Symfony cache and, if using a compiled container in production, warm it up again.

  • Privacy and consent need deliberate handling. Social share buttons can leak the current URL via referrer or load third-party scripts. If your site has GDPR/consent requirements, consider replacing script-based buttons with plain links, adding rel="noopener noreferrer", or gating the buttons behind consent.

  • Do not expect share counts. This bundle is primarily a button renderer. If you need counts, you will be integrating provider APIs or client-side scripts yourself, and those are exactly the parts most likely to break over time.

  • Debugging path: inspect vendor/ezsystems/share-buttons-bundle/Resources/config/, Resources/views/, and the Twig extension class. Use debug:twig to confirm the helper is registered and container:debug to inspect provider services. In legacy eZ stacks, also confirm the bundle is loaded in the correct kernel.

  • Prefer a small local implementation for new work. For a modern Symfony application, a handful of provider templates and a Twig partial are usually simpler, safer, and easier to maintain than adopting an archived bundle with zero dependents.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin