heise/shariff
PHP backend for Shariff that fetches social share counts without client-side requests to social networks. Supports Buffer, Facebook, Pinterest, Reddit, Xing, VK and more, with domain whitelisting and configurable caching (filesystem or Laminas adapters).
Http facade remains compatible.Cache facade compatibility./shares endpoint changes). Test thoroughly.fields parameter in API calls (e.g., shares may require link.shares).config/shariff.php)./me/links or /shares endpoints? Verify against v25.0 docs.config/shariff.php):
'services' => [
'facebook' => true,
'twitter' => true,
// 'stumbleupon' => false, // Explicitly disable
// 'flattr' => false,
],
ShariffService as before.Cache facade (Redis/file). No changes required.shariff:fetch jobs (unchanged)./api/shariff, validate responses for missing fields (e.g., stumbleupon).// Before (if using StumbleUpon)
shariff.init({
services: ['facebook', 'stumbleupon'],
});
// After
shariff.init({
services: ['facebook', 'twitter'], // Updated
});
Phase 0: Pre-Upgrade Validation (New)
/me/links?fields=shares and verify response structure.stumbleupon/flattr (e.g., configs, templates, analytics).Phase 1: Standalone API Update
/shariff directory)./shariff?url={encoded_url}.link.shares).null or omit).Phase 2: Laravel Integration
composer.json to heise/shariff:^11.0.composer update.config/shariff.php to disable removed services:
'services' => [
'facebook' => true,
'twitter' => true,
// 'stumbleupon' => false,
// 'flattr' => false,
],
ShariffService wrapper (no changes needed).Phase 3: Caching Layer
shariff_{url}_stumbleupon).Cache::forget("shariff_{$url}_stumbleupon");
Cache::forget("shariff_{$url}_flattr");
Phase 4: Frontend Sync
services config in shariff.init().fetch('/api/shariff?url=' + encodeURIComponent(url))
.then(response => response.json())
.then(data => {
// Handle missing services
if (!data.facebook) data.facebook = { shares: 0 };
renderShareCounts(data);
});
fields parameter for v25.0. Example:
// Old (may break in v25.0)
$response = $facebook->get("/me/links?href={$url}&fields=shares");
// New (if required)
$response = $facebook->get("/me/links?href={$url}&fields=link.shares");
| Step | Priority | Dependencies |
|---|---|---|
| Pre-Upgrade Validation | Critical | None |
| Deploy standalone v11.0.0 | High | Validation results |
| Update Laravel config | Medium | Standalone testing |
| Invalidate cache entries | High | Config updates |
| Frontend button updates | Low | API stability |
| Monitor Facebook API v25.0 | Ongoing | All phases |
config/shariff.php to disable removed services.v25.0) in config comments.try {
$counts = $shariff->get($url);
} catch (\Exception $e) {
Log::warning("Shariff API warning for {$url}: " . $e->getMessage());
return $fallbackCounts;
}
How can I help you explore Laravel packages today?