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

Simple Bus Bridge Bundle Laravel Package

bengor-user/simple-bus-bridge-bundle

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Event-Driven Alignment: The bundle bridges Symfony’s UserBundle (user management) with SimpleBus (event-driven messaging), enabling a CQRS/Event Sourcing pattern for user-related workflows. This is a strong fit for systems requiring decoupled, asynchronous user operations (e.g., notifications, auditing, or workflows triggered by user actions).
  • Symfony Ecosystem: Leverages Symfony’s Dependency Injection (DI) and Bundle architecture, reducing boilerplate for integrating SimpleBus into a Laravel/Lumen project (via Laravel Symfony Bridge or API Platform).
  • Domain-Driven Design (DDD): Aligns with aggregate roots and domain events, useful for complex user workflows (e.g., account creation → verification → activation).

Integration Feasibility

  • Laravel Compatibility:
    • Direct Use: Not natively compatible with Laravel (Symfony-specific). Requires Symfony components (e.g., symfony/dependency-injection, symfony/http-kernel) or a Laravel-Symfony bridge (e.g., laravel-symfony-bundle).
    • API Layer: Can be used in a Lumen/Symfony microservice that Laravel consumes via REST/gRPC, acting as an event producer/consumer.
  • SimpleBus in Laravel:
    • SimpleBus is PHP-agnostic and can be integrated directly into Laravel using:
    • The bundle’s Symfony-specific glue (e.g., UserBundle integration) would need manual adaptation for Laravel’s Auth system.

Technical Risk

Risk Area Assessment
Deprecation Risk Last release in 2017; no dependents or activity. High risk of breaking changes with newer Symfony/Laravel versions.
Symfony Dependency Heavy reliance on Symfony components (e.g., UserBundle, EventDispatcher). Laravel’s Auth system differs significantly, requiring custom adapters or refactoring.
Testing Gaps Tests use PHPSpec (BDD), but no Laravel-specific tests. Integration risks in Laravel’s service container, event system, or auth lifecycle.
Event Schema Mismatch SimpleBus expects strict event contracts; Laravel’s Auth events (e.g., Registered, LoggedIn) may not align with SimpleBus’s command/query patterns. Manual mapping required.
Performance Overhead Symfony’s EventDispatcher + SimpleBus adds indirection. In Laravel, direct queue jobs (e.g., Illuminate\Queue) may be simpler for async workflows.

Key Questions

  1. Why SimpleBus?

    • Does the project need explicit command/query separation (vs. Laravel’s queue jobs or events)?
    • Is event sourcing or CQRS a core requirement, or is decoupled messaging sufficient?
  2. Symfony vs. Laravel Tradeoffs

    • Can the team maintain a Symfony microservice for event handling, or is a pure Laravel solution (e.g., spatie/laravel-simple-bus) preferable?
    • Are there existing Symfony bundles in the stack that justify this dependency?
  3. Migration Path

    • How will user events (e.g., Auth::login) be mapped to SimpleBus commands?
    • Will legacy Symfony code need to coexist with Laravel, or is a greenfield integration possible?
  4. Long-Term Viability


Integration Approach

Stack Fit

Component Laravel Compatibility
SimpleBusBridgeBundle Not natively compatible. Requires:
- Symfony Kernel (e.g., via Lumen or Symfony Standalone).
- Laravel-Symfony Bridge (e.g., laravel-symfony-bundle) to share DI containers.
SimpleBus (Core) Compatible via:
- simple-bus/simple-bus (standalone PHP).
- spatie/laravel-simple-bus (Laravel wrapper).
UserBundle Incompatible. Laravel’s Auth system differs. Options:
- Replace with Laravel’s Illuminate\Auth and manually emit SimpleBus events.
- Use Symfony’s UserBundle in a separate service (e.g., Lumen API) that Laravel calls.

Migration Path

  1. Assess Event Needs

    • Audit user-related workflows (e.g., registration, login, role changes).
    • Define SimpleBus commands/events (e.g., CreateUserCommand, UserRegisteredEvent).
  2. Option 1: Hybrid Symfony-Laravel (High Risk)

    • Deploy a Lumen/Symfony microservice hosting SimpleBusBridgeBundle.
    • Laravel emits HTTP/gRPC calls to this service for user operations.
    • Pros: Reuses bundle as-is.
    • Cons: Complex deployment, network latency, tight coupling.
  3. Option 2: Pure Laravel (Recommended)

    • Replace UserBundle with Laravel’s Auth.
    • Integrate SimpleBus directly:
      // Example: Using spatie/laravel-simple-bus
      use Spatie\SimpleBus\Commands\Bus;
      use Spatie\SimpleBus\Commands\Command;
      
      class RegisterUserCommand implements Command {
          public function handle() {
              // Business logic
          }
      }
      
      // Emit from Laravel Auth listener:
      Auth::attempt([...])->then(function () {
          Bus::dispatch(new RegisterUserCommand());
      });
      
    • Pros: Native Laravel, no Symfony dependency, easier maintenance.
    • Cons: Loses bundle’s UserBundle integration.
  4. Option 3: Fork & Adapt (Medium Risk)

    • Fork the bundle and rewrite UserBundle dependencies to use Laravel’s Auth.
    • Example: Replace UserBundle\Event\UserEvent with Illuminate\Auth\Events\Registered.
    • Pros: Reuses bundle structure.
    • Cons: Maintenance burden, fork divergence.

Compatibility

Laravel Feature Compatibility Notes
Service Container SimpleBusBridgeBundle uses Symfony’s DI. Laravel’s container is incompatible without a bridge (e.g., laravel-symfony-bundle).
Event System Laravel’s Event system differs from Symfony’s EventDispatcher. Manual mapping required for UserBundle events.
Auth System UserBundle’s User entity is not compatible with Laravel’s Illuminate\Auth\User. Custom adapters needed.
Queue Workers SimpleBus uses message queues (e.g., RabbitMQ, Redis). Laravel’s Illuminate\Queue can interoperate if configured similarly.
PHP 8.x Support Bundle requires PHP 5.5+ but has no PHP 8.x tests. May need dependency updates (e.g., Symfony 6.x).

Sequencing

  1. Phase 1: Proof of Concept (2-4 weeks)

    • Set up SimpleBus in Laravel (e.g., using spatie/laravel-simple-bus).
    • Define 2-3 critical user commands/events (e.g., registration, login).
    • Test performance vs. Laravel’s native queue jobs.
  2. Phase 2: Bundle Adaptation (4-8 weeks)

    • Fork the bundle and replace `UserBundle
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.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours