friendsofvictoire/sharethis-widget
A Laravel package for quickly integrating ShareThis social sharing widgets into Blade views. Add configurable share buttons with minimal setup, making it easy for visitors to share your content across social networks.
First, the reality check. friendsofvictoire/sharethis-widget is not a Laravel package — it is a Symfony bundle for Victoire DCMS (FriendsOfVictoire/WidgetShareThisBundle). It ships no service provider, no config/sharethis.php, no Blade views, and no facade. Running composer require friendsofvictoire/sharethis-widget in a Laravel app will install files into vendor/ that Laravel will never autoload into a service container, because the widget class extends a Victoire base widget class that isn't installed. The only thing you get for free is a Twig template.
Where to look first. Ignore the bundle plumbing (WidgetShareThisBundle.php, DependencyInjection/, Resources/config/config.yml) — that's Victoire registration glue. Read exactly two files:
Widget/ShareThisWidget.php — the widget model; in a ShareThis widget this is almost always an empty shell (no persisted fields, no business logic, just an ID and a template reference).Resources/views/Widget/ShareThisWidget.html.twig — the actual deliverable: a <div> plus the ShareThis <script> tag.First use case is therefore a port, not an integration. Lift the markup into a Blade partial and you're done in ten minutes:
{{-- resources/views/partials/sharethis.blade.php --}}
<div class="sharethis-inline-share-buttons"
data-url="{{ $url ?? url()->current() }}"
data-title="{{ $title ?? '' }}"></div>
@once
<script src="https://platform-api.sharethis.com/js/sharethis.js#property={{ config('services.sharethis.property_id') }}&product=inline-share-buttons" async></script>
@endonce
// config/services.php
'sharethis' => ['property_id' => env('SHARETHIS_PROPERTY_ID')],
Good news: the widget has no entities, no migrations, no repositories, and no routes. There is nothing to port except presentation.
If you are staying on Symfony/Victoire: register the bundle in AppKernel/bundles.php, ensure it is enabled alongside the Victoire core bundles, and the widget shows up in the DCMS widget picker for any page slot. Configuration is done by DCMS editors, not by developers — there is no per-instance PHP config.
If you are porting to Laravel (the likely case here), mirror the widget's shape rather than its implementation:
<x-sharethis :url="$post->canonicalUrl()" />) so the URL/title logic lives in one place and cannot drift from the markup.resources/views/posts/show.blade.php and any other show/detail view; pass an explicit canonical URL rather than letting each page fall back to url()->current(), which breaks with query strings and pagination.:networks="['facebook','x','linkedin']", size="large". ShareThis accepts these as data-* attributes on the container.data-url, and the script tag appears exactly once when the partial is included twice on a page (@once handles same-render duplicates).symfony/framework-bundle constraints and the symfony/symfony versus split-package conflict. The real blocker is Victoire's own base widget bundle, which is also dormant — you cannot simply bump a constraint.<script> after analytics or marketing consent is granted) or you inherit a compliance problem the 2016 bundle never considered.script-src https://platform-api.sharethis.com and typically img-src/frame-src/connect-src entries for *.sharethis.com. Symptom of a missing CSP entry is a silent no-op — the div renders and nothing appears.@once scoping. @once only deduplicates within a single Blade render pass. If two separate view composers or View::render calls each emit the partial, you get duplicate script tags; use a View::share flag or render the script once in the layout instead.sharethis-inline-share-buttons, and the script tag is actually present in the DOM. ShareThis fails without logging anything useful.resources/views/vendor/sharethis/ and check there first.<script> in layouts/app.blade.php and the <div> in views — the property ID then can't be overridden per page and the two drift apart on refactor.How can I help you explore Laravel packages today?