Weave Code
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

Common Bundle Laravel Package

elasticms/common-bundle

Shared library bundle for elasticMS, used by the Core and Client Helper bundles. Provides common code, utilities, and services to keep the platform consistent. Documentation available on the EMS project site; issues and PRs via the elasticMS monorepo.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Modularity & Reusability: The elasticms/common-bundle is a shared utility layer designed for the EMS ecosystem, likely containing domain-agnostic helpers (e.g., validation, logging, DTOs, or event-driven workflows). It aligns well with Laravel applications requiring cross-cutting concerns (e.g., multi-tenancy, API standardization) but lacks Laravel-native abstractions (e.g., Eloquent, Blade).
  • Laravel-Symfony Bridge: The bundle’s reliance on Symfony components (e.g., HttpFoundation, EventDispatcher) introduces friction. Laravel’s illuminate/support provides partial compatibility, but custom adapters may be needed for:
    • Service Container: Symfony’s ContainerInterface vs. Laravel’s Container.
    • Events: Symfony’s EventDispatcher vs. Laravel’s Events facade.
    • HTTP: Symfony\Component\HttpFoundation\Request vs. Illuminate\Http\Request.
  • Domain Alignment: Assess whether the bundle’s abstractions (e.g., Content, Media) map to your Laravel app’s needs. For example:
    • CMS-like features: Useful for content modeling.
    • API gateways: Shared serializers/validators.
    • Multi-tenancy: Tenant-aware helpers.
    • Non-CMS apps: Risk of over-engineering.

Integration Feasibility

  • Dependency Conflicts:
    • The bundle may pull Symfony packages (e.g., symfony/http-client, symfony/options-resolver) conflicting with Laravel’s versions. Mitigate with:
      • Composer constraints: composer require elasticms/common-bundle --with-all-dependencies.
      • Custom wrappers: Isolate Symfony dependencies in a separate service provider.
    • Example conflict resolution:
      // composer.json
      "conflict": {
        "symfony/http-client": "dev-main" // Force Laravel-compatible version
      }
      
  • Configuration Overrides:
    • Symfony bundles use config/packages/. Laravel requires custom config files (e.g., config/elasticms.php). Use a service provider to merge configurations:
      // ElasticmsServiceProvider.php
      public function register()
      {
          $this->mergeConfigFrom(__DIR__.'/../config/elasticms.php', 'elasticms');
      }
      
  • Event System:
    • Symfony’s EventDispatcher differs from Laravel’s Events. Create a bridge:
      // app/Providers/EventBridgeServiceProvider.php
      use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
      use Illuminate\Support\Facades\Event;
      
      public function boot()
      {
          $symfonyDispatcher = new SymfonyDispatcher();
          Event::listen(function ($event) use ($symfonyDispatcher) {
              $symfonyDispatcher->dispatch($event->getName(), $event);
          });
      }
      

Technical Risk

  • Undocumented Assumptions:
    • No dependents or stars suggest untested real-world use. Key risks:
      • Hidden dependencies: E.g., PHP extensions (intl, gd), specific Symfony versions.
      • API instability: Last release in 2026 may hide breaking changes.
    • Mitigation: Static analysis (phpstan, psalm) and unit tests for core components.
  • Performance Overhead:
    • Symfony’s event listeners or proxies may introduce latency. Profile with:
      php artisan debug:container  # Check service overhead
      
  • License Compliance:
    • LGPL-3.0 requires dynamic linking. If you fork/modify, ensure compliance or switch to MIT/Apache alternatives.
  • Testing Gaps:
    • Without tests, integration risks include:
      • Runtime errors from Symfony/Laravel API mismatches.
      • Configuration drift if bundle expects Symfony’s parameters.yaml.
    • Mitigation: Feature flags for gradual adoption.

Key Questions

  1. What EMS-specific logic does this bundle encapsulate?
    • Example: Custom validators, DTOs, or CMS workflows.
    • Does your Laravel app need these, or are Laravel packages (e.g., spatie/laravel-medialibrary) sufficient?
  2. How does the bundle handle:
    • Service container binding? (Symfony’s autowiring vs. Laravel’s bind())
    • Configuration? (YAML vs. Laravel’s PHP arrays)
    • Events? (Symfony’s EventDispatcher vs. Laravel’s Events)
  3. Are there Laravel-native alternatives?
    • Compare with spatie/laravel-package-tools, laravelista/laravel-modules.
  4. What’s the rollback plan if integration fails?
    • Extract bundle logic into a custom package or rewrite components.
  5. How will you handle future breaking changes?
    • Fork the bundle or patch critical components.

Integration Approach

Stack Fit

  • Laravel-Symfony Compatibility:
    • Use Laravel’s Symfony bridge (illuminate/support) for:
      • HTTP: Symfony\Component\HttpFoundation\RequestIlluminate\Http\Request.
      • Console: Symfony\Component\ConsoleIlluminate\Console.
    • For events, create a bidirectional bridge:
      // app/Providers/EventBridgeServiceProvider.php
      use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
      
      public function register()
      {
          $symfonyDispatcher = new SymfonyDispatcher();
          $this->app->singleton('symfony.event_dispatcher', fn() => $symfonyDispatcher);
      
          // Listen to Laravel events and dispatch to Symfony
          Event::listen('*', function ($event) use ($symfonyDispatcher) {
              $symfonyDispatcher->dispatch($event->getName(), $event);
          });
      }
      
  • Dependency Isolation:
    • Option 1: Fork the bundle and replace Symfony dependencies with Laravel equivalents.
      • Example: Replace Symfony\Component\EventDispatcher with Illuminate\Events\Dispatcher.
    • Option 2: Extract only needed classes (e.g., DTOs, helpers) into a custom package.
    • Option 3: Use Composer’s replace to force Laravel-compatible versions:
      "replace": {
        "symfony/http-client": "1.0.0|dev-main"
      }
      

Migration Path

  1. Phase 1: Proof of Concept (PoC)

    • Install the bundle in a sandbox Laravel project:
      composer require elasticms/common-bundle
      
    • Test core functionality:
      • Service instantiation: app('ems.common.service').
      • Event firing: event(new \EMS\CommonBundle\Event\CustomEvent()).
      • Configuration loading: config('elasticms.services.timeout').
    • Log errors/warnings and document workarounds.
  2. Phase 2: Incremental Adoption

    • Start with non-critical modules:
      • Shared DTOs: Replace custom data transfer objects.
      • Logging helpers: Integrate EMS\CommonBundle\Logger\TenantLogger.
    • Gradually replace custom helpers with bundle equivalents.
    • Use feature flags to toggle bundle usage:
      if (config('app.enable_ems_bundle')) {
          $service = app('ems.common.service');
      }
      
  3. Phase 3: Full Integration

    • Migrate configuration to Laravel’s format:
      // config/elasticms.php
      return [
          'services' => [
              'timeout' => env('EMS_TIMEOUT', 30),
          ],
      ];
      
    • Replace Symfony-specific code with Laravel equivalents (e.g., Route objects).
    • Deprecate old custom logic via deprecation warnings.

Compatibility

Symfony Feature Laravel Equivalent Integration Strategy
Symfony\Component\HttpFoundation\Request Illuminate\Http\Request Use Laravel’s Request facade; wrap Symfony calls.
Symfony\Component\EventDispatcher Illuminate\Events\Dispatcher Create a bridge service provider.
Symfony\Component\Console\Command Illuminate\Console\Command Extend Laravel’s Command class.
Symfony\Component\DependencyInjection\Container Illuminate\Container\Container Use Laravel’s container; avoid direct Symfony DI.
Symfony\Component\Config\Loader\LoaderInterface Illuminate\Config\Repository Merge YAML config into Laravel’s PHP arrays.
Symfony\Component\Routing\RequestContext Illuminate\Routing\Router Use Laravel’s router; avoid Symfony routing.

Sequencing

  1. Prioritize Low-Risk Components:
    • Start with stateless helpers (e.g., D
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-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views