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 Laravel Package

bengor-file/simple-bus-bridge

Adapter bridge that integrates BenGorFile's File library with Matthias Noback's SimpleBus, enabling File commands/events to be dispatched through SimpleBus. Install via Composer and run tests with PHPSpec.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Event-Driven Alignment: The package bridges File (a file-based persistence layer) with SimpleBus (a PHP messaging library), enabling event sourcing or CQRS patterns in Laravel applications. This aligns well with architectures requiring decentralized command/event handling or offline-capable workflows (e.g., background jobs, audit trails, or file-based state management).
  • Laravel Compatibility: While Laravel has its own event system and queues, this package could complement:
    • Legacy systems migrating from SimpleBus to Laravel.
    • Hybrid architectures where file-based persistence is preferred for certain domains (e.g., large binary data, offline processing).
    • Testing/Isolation: Simulating event-driven workflows without a full database dependency.

Integration Feasibility

  • SimpleBus Dependency: Requires Matthias Noback’s SimpleBus (simplebus/simple-bus), which is a lightweight messaging library. Laravel does not natively support SimpleBus, so this would introduce a new dependency stack (SimpleBus + File library).
  • PHP Version Constraint: Requires PHP ≥5.5 (Laravel 5.5+ supports this, but older versions may need upgrades).
  • Laravel Service Provider: Would need a custom service provider to integrate SimpleBus with Laravel’s container and event system (e.g., mapping SimpleBus messages to Laravel events or vice versa).
  • File Library Dependency: The File library (by the same author) is required for persistence. This adds complexity if the team isn’t already using it.

Technical Risk

  • Abandoned Maintenance: Last release in 2018 with no stars/dependents raises concerns about:
    • Security vulnerabilities (e.g., PHP 5.5 EOL in 2016, PHP 7.x deprecations).
    • Compatibility with modern Laravel (e.g., PSR-15 middleware, Laravel 10+ changes).
    • Lack of community support for troubleshooting.
  • Design Friction:
    • SimpleBus is not idiomatic Laravel; developers would need to learn a new messaging paradigm.
    • File-based persistence may conflict with Laravel’s Eloquent/Queue systems (e.g., transaction management, retries).
  • Testing Overhead: PHPSpec tests may not align with Laravel’s testing tools (PHPUnit/Pest), requiring additional test setup.

Key Questions

  1. Why File + SimpleBus?
    • Is there a specific use case (e.g., offline processing, large file handling) that justifies deviating from Laravel’s native tools?
    • Could Laravel’s queues or filesystem events achieve the same goal with less risk?
  2. Migration Path
    • How would this integrate with existing Laravel events/jobs? Would it replace them or run in parallel?
    • Are there plans to maintain/update the package for Laravel 10+?
  3. Performance/Scaling
    • How does file-based persistence scale compared to Laravel’s database/queue systems?
    • What are the failure modes (e.g., disk failures, message loss)?
  4. Alternatives
    • Could Laravel Horizon (for queues) + Laravel Filesystem Events suffice?
    • Is there a more modern PHP event bus (e.g., Symfony Messenger, ReactPHP) that’s Laravel-compatible?

Integration Approach

Stack Fit

  • Target Use Case: Best suited for:
    • Legacy system modernization (e.g., replacing a SimpleBus-based app with Laravel while keeping file persistence).
    • Specialized domains where file-based workflows are critical (e.g., media processing, batch jobs).
    • Prototyping event-driven architectures before committing to Laravel’s native tools.
  • Laravel Stack Conflicts:
    • SimpleBus vs. Laravel Events: SimpleBus is a command bus, while Laravel uses events for pub/sub. Overlap may require careful abstraction.
    • Queue Systems: Laravel’s queues (Redis, database) are optimized for performance; File-based persistence may introduce latency.
    • Dependency Bloat: Adding SimpleBus + File library increases complexity for a small package.

Migration Path

  1. Assessment Phase:
    • Audit existing Laravel event/job workflows to identify candidates for SimpleBus/File integration.
    • Benchmark performance (e.g., throughput, latency) against Laravel’s native tools.
  2. Proof of Concept:
    • Implement a single domain (e.g., image processing) using SimpleBusBridge.
    • Compare with a Laravel-native equivalent (e.g., queues + filesystem events).
  3. Gradual Rollout:
    • Phase 1: Use SimpleBusBridge for non-critical file-based workflows.
    • Phase 2: Build adapters to sync SimpleBus messages with Laravel events (e.g., via a message listener).
    • Phase 3: Evaluate replacement with Laravel’s native tools or a more maintained package.
  4. Fallback Plan:
    • If maintenance becomes an issue, replace with:
      • Symfony Messenger (more modern, Laravel-compatible).
      • Laravel’s built-in queues/filesystem events.

Compatibility

  • Laravel Version: Tested with PHP 5.5+, but Laravel 5.5+ is recommended. For Laravel 10+, expect breaking changes (e.g., PHP 8.x features, dependency updates).
  • Service Provider Integration:
    // Example: Register SimpleBus in Laravel
    $this->app->bind('SimpleBus\Message\Bus\Bus', function ($app) {
        return new SimpleBus\Message\Bus\Bus(
            new SimpleBus\Message\Bus\Plugin\RouterPlugin(
                new SimpleBus\Message\Bus\Plugin\FirstPlugin(),
                new SimpleBus\Message\DispatchingRouter()
            )
        );
    });
    
  • Event Mapping: Create a bridge layer to convert between:
    • SimpleBus commands/messages ↔ Laravel events/jobs.
    • Example: Dispatch a Laravel event when a SimpleBus message is handled.

Sequencing

  1. Dependency Setup:
    • Install via Composer:
      composer require bengor-file/simple-bus-bridge simplebus/simple-bus bengor-file/file
      
    • Configure File library for persistence (e.g., storage paths).
  2. Core Integration:
    • Register SimpleBus in Laravel’s container.
    • Implement a message handler for file-based operations.
  3. Laravel Sync:
    • Add listeners to translate SimpleBus messages to Laravel events.
    • Example:
      // Listen for SimpleBus messages and emit Laravel events
      event(new FileProcessed($filePath));
      
  4. Testing:
    • Write PHPSpec tests (as provided) alongside Laravel tests.
    • Test failure scenarios (e.g., disk full, message corruption).

Operational Impact

Maintenance

  • High Risk Due to Abandonware:
    • No updates since 2018 → Potential security/compatibility issues.
    • MIT License is permissive, but lack of maintenance is a liability.
  • Workarounds:
    • Fork and maintain the package (if critical).
    • Isolate dependencies (e.g., use Docker to pin PHP 5.5 if necessary).
  • Dependency Management:
    • Monitor File library and SimpleBus for updates.
    • Consider rewriting critical components if the package becomes unsustainable.

Support

  • Limited Community:
    • No GitHub stars/issues → no public troubleshooting.
    • Gitter chat is inactive (last activity pre-2018).
  • Internal Support Plan:
    • Document custom integrations thoroughly.
    • Assign a tech lead to own the bridge layer.
    • Prepare for self-service debugging (e.g., logs, metrics).

Scaling

  • Performance Bottlenecks:
    • File-based persistence may not scale for high-throughput systems (e.g., >1000 messages/sec).
    • No built-in retry/backoff for failed messages (unlike Laravel queues).
  • Horizontal Scaling:
    • SimpleBus is stateless, but File library may require shared storage (e.g., S3, NFS).
    • Laravel’s queues (Redis/database) are better optimized for distributed workers.
  • Monitoring:
    • Track:
      • Message processing latency.
      • Disk I/O bottlenecks.
      • Message loss (e.g., unhandled exceptions).

Failure Modes

Failure Scenario Impact Mitigation
Disk failure (File library) Lost messages/data Use redundant storage (e.g., S3 + local).
SimpleBus message corruption Silent failures Add checksum validation for messages.
PHP 5.5 deprecations Breaking changes in Laravel 10+ **
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.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity