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

Shariff Bundle Laravel Package

cedricziel/shariff-bundle

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony2 Bundle for Heise Shariff: The package is a Symfony2-specific bundle, which means it is tightly coupled to the Symfony2 framework. If the target application is Symfony 2.x, this is a direct fit for integrating Shariff (a privacy-friendly alternative to traditional social sharing buttons).
  • Laravel Compatibility: Since Laravel is not Symfony, this bundle cannot be directly used in a Laravel application without significant refactoring or wrapper abstraction. However, the underlying Shariff PHP library (heiseonline/shariff-backend-php) could be leveraged independently in Laravel.
  • Modularity: The bundle follows Symfony’s modular design, making it easy to integrate into a Symfony2 app but requiring a custom solution for Laravel.

Integration Feasibility

  • Symfony2: Low risk—follows standard Symfony2 bundle patterns (routing, configuration, services). Minimal customization needed if requirements align with the bundle’s defaults.
  • Laravel: High risk—requires either:
    • Option 1: Rewriting the bundle logic as a Laravel package (e.g., using Laravel’s service providers, route definitions, and config system).
    • Option 2: Directly integrating the heiseonline/shariff-backend-php library into Laravel’s service container and routing.
  • Frontend Integration: Shariff relies on JavaScript for rendering buttons. The bundle provides backend logic (e.g., generating shariff.json), so frontend integration (e.g., Twig/Blade templates) must be handled separately.

Technical Risk

Risk Area Symfony2 Risk Laravel Risk
Framework Compatibility Low High (requires refactoring)
Configuration Complexity Low Medium (custom Laravel setup)
Dependency Conflicts Low Medium (PHP version, Symfony dependencies)
Maintenance Overhead Low High (forking/extending bundle)
Performance Impact Negligible Negligible (if implemented cleanly)
  • Key Risks for Laravel:
    • Symfony dependencies (e.g., symfony/dependency-injection, symfony/config) may conflict with Laravel’s ecosystem.
    • Lack of active maintenance (0 stars, no dependents) increases long-term risk.
    • Shariff’s backend logic assumes Symfony’s request/response handling, which differs in Laravel.

Key Questions

  1. Is Symfony2 the target framework?
    • If yes, proceed with bundle integration.
    • If no (Laravel), evaluate whether to:
      • Build a Laravel-specific package from scratch.
      • Use the underlying Shariff PHP library directly.
  2. What are the Shariff configuration requirements?
    • Custom domains, protocols, or caching strategies may need adjustments.
  3. Is JavaScript integration already in place?
    • The bundle only handles backend logic; frontend (shariff.js) must be separately managed.
  4. What is the long-term maintenance plan?
    • Given the bundle’s low activity, assess whether forking or replacing with a maintained alternative (e.g., laravel-shariff) is viable.
  5. Are there alternative packages?

Integration Approach

Stack Fit

Component Symfony2 Fit Laravel Fit
Routing Native (Symfony2) Custom (Laravel routes)
Configuration YAML/XML PHP/ENV (Laravel config)
Dependency Injection Symfony DI Laravel Service Container
Caching Symfony Cache Laravel Cache (Redis, File)
Frontend Twig Blade/Vue/React
  • Symfony2:
    • Seamless integration via Composer and AppKernel.php.
    • Uses Symfony’s routing (routing.xml) and configuration system.
  • Laravel:
    • Requires a custom package or direct library integration.
    • Example steps for Laravel:
      1. Install heiseonline/shariff-backend-php via Composer.
      2. Create a Laravel service provider to configure Shariff.
      3. Register routes for /_shariff endpoint.
      4. Bind Shariff’s Shariff class to Laravel’s container.
      5. Generate shariff.json dynamically in a controller/middleware.

Migration Path

Symfony2 Migration

  1. Install Bundle:
    composer require cedricziel/shariff-bundle
    
  2. Enable Bundle:
    // app/AppKernel.php
    new CedricZiel\ShariffBundle\CedricZielShariffBundle(),
    
  3. Configure Routing:
    # app/config/routing.yml
    cedricziel_shariff:
        resource: "@CedricZielShariffBundle/Resources/config/routing.xml"
        prefix: /_shariff
    
  4. Set Configuration:
    # app/config/config.yml
    cedricziel_shariff:
        domain: '%domain%'
        force_protocol: https
        cache:
            cacheDir: '%kernel.cache_dir%/shariff'
    
  5. Integrate Frontend:
    • Include shariff.js and render buttons via Twig:
      {{ render_shariff(url) }}
      

Laravel Migration

  1. Install Shariff Library:
    composer require heiseonline/shariff-backend-php
    
  2. Create Service Provider:
    // app/Providers/ShariffServiceProvider.php
    namespace App\Providers;
    
    use Illuminate\Support\ServiceProvider;
    use Shariff\Shariff;
    
    class ShariffServiceProvider extends ServiceProvider
    {
        public function register()
        {
            $this->app->singleton('shariff', function () {
                return new Shariff(config('shariff.domain'), config('shariff.force_protocol'));
            });
        }
    
        public function boot()
        {
            $this->loadRoutesFrom(__DIR__.'/../routes/shariff.php');
        }
    }
    
  3. Define Routes:
    // routes/shariff.php
    Route::get('/_shariff', function () {
        return response()->json(app('shariff')->getShariffJson());
    })->name('shariff.json');
    
  4. Configure .env:
    SHARIFF_DOMAIN=yourdomain.com
    SHARIFF_FORCE_PROTOCOL=https
    
  5. Integrate Frontend:
    • Include shariff.js and render buttons in Blade:
      <div class="shariff" data-url="{{ url()->current() }}"></div>
      

Compatibility

  • Symfony2:
    • Fully compatible with the bundle’s design.
    • Assumes Symfony2’s request lifecycle (e.g., RequestStack for domain detection).
  • Laravel:
    • Breaking Changes:
      • Symfony-specific classes (e.g., Symfony\Component\HttpFoundation\Request) must be replaced with Laravel equivalents.
      • Caching may need adaptation (e.g., symfony/cache → Laravel’s cache system).
    • Workarounds:
      • Use Laravel’s Request class to mimic Symfony’s request object.
      • Replace Symfony\Component\Config\* with Laravel’s config system.

Sequencing

  1. Symfony2:
    • Install → Configure → Route → Test → Frontend Integration.
  2. Laravel:
    • Install library → Create provider → Configure → Route → Test → Frontend Integration.
    • Critical Step: Verify shariff.json generation matches Symfony2’s output before frontend integration.

Operational Impact

Maintenance

Aspect Symfony2 Laravel
Updates Bundle updates via Composer Manual updates (library or custom package)
Bug Fixes Report to bundle maintainer Self-hosted fixes required
Dependency Updates Managed by Symfony Manual resolution of conflicts
Documentation Limited (README-driven) None (requires custom docs)
  • Symfony2:
    • Low maintenance overhead; follows Symfony’s update cycles.
  • Laravel:
    • High maintenance overhead due to custom implementation.
    • Risk of drift from upstream Shariff library changes.

Support

  • Symfony2:
    • Community support limited (0 stars, no dependents).
    • Fallback: Fork and maintain or use
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.
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc