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

enqueue/simple-client

Enqueue Simple Client combines Enqueue client classes with Symfony components into an easy-to-use SimpleClient facade for sending and consuming messages via queues. Part of the Enqueue ecosystem; see docs and support via the project site.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Facade Overhead: The SimpleClient abstracts Enqueue’s complexity but adds a thin layer of indirection. For Laravel, this is beneficial as it aligns with the framework’s philosophy of simplicity while unlocking advanced queue features (e.g., multi-transport support, priority queues). The facade pattern reduces boilerplate for common operations (e.g., connection management, message serialization), making it ideal for teams prioritizing developer velocity.
  • Decoupling and Extensibility: The package’s design enables loose coupling between Laravel’s job system and the underlying message broker (e.g., RabbitMQ, Redis). This is critical for microservices or modular architectures where queue backends may evolve independently. The SimpleClient can act as a bridge between Laravel’s Illuminate\Queue and Enqueue’s transport-agnostic abstractions, allowing teams to swap brokers without refactoring job logic.
  • Symfony Synergy: Leverages Symfony’s Config and YAML components, which are already integrated into Laravel (via symfony/console, symfony/finder, etc.). This reduces friction for teams familiar with Symfony’s ecosystem and enables shared configurations across Laravel and Symfony microservices.
  • Event-Driven Alignment: Complements Laravel’s event system (Illuminate\Events) and notifications (Illuminate\Notifications) by providing a robust foundation for asynchronous workflows. For example, failed notifications can be retried via Enqueue’s retry mechanisms, while successful ones can trigger downstream jobs.

Integration Feasibility

  • Laravel Queue System: The SimpleClient can be seamlessly integrated into Laravel’s queue system by registering it as a custom driver. This allows existing Laravel jobs to leverage Enqueue’s features without modifying job classes. The integration path is well-documented in the Enqueue Laravel bridge, which provides a QueueServiceProvider and EnqueueConnection to handle driver registration.
  • Job Serialization: Laravel’s queue system relies on job serialization (e.g., JSON, PHP serialization). The SimpleClient supports Enqueue’s Message class, which can serialize Laravel jobs via serialize()/unserialize() or JSON. This may require custom serializers for complex job payloads (e.g., closures, resources).
  • Consumer Workflow: Replaces Laravel’s queue:work with Enqueue’s enqueue:consume, which offers advanced features like:
    • Concurrent workers (scaling horizontally).
    • Dynamic scaling (e.g., Kubernetes-based auto-scaling).
    • Plugin-based extensions (e.g., monitoring, dead-letter queues).
  • Transport Flexibility: Enables switching between transports (e.g., RabbitMQ for production, filesystem for development) via configuration. This is particularly useful for Laravel SaaS applications with multi-tenant queue requirements.

Technical Risk

  • Dependency Versioning: The package depends on enqueue/enqueue (v0.10+) and queue-interop (v1.0+), which may introduce conflicts with Laravel’s dependencies or require pinning versions. For example:
    • symfony/config (used by Enqueue) may conflict with Laravel’s symfony/console or symfony/dependency-injection.
    • php-amqplib (AMQP transport) may have compatibility issues with older PHP versions or non-standard AMQP brokers.
  • PHP Version Support: Requires PHP 8.1+, which may necessitate upgrading Laravel 8.x applications or using compatibility layers (e.g., php-compat).
  • Learning Curve: While the facade simplifies basic usage, advanced features (e.g., custom exchanges, plugins) require familiarity with AMQP concepts. Teams new to Enqueue may need training or documentation to leverage its full potential.
  • Testing Complexity: The package’s test suite includes Enqueue-specific tests (e.g., mock brokers, message validation), which may not translate directly to Laravel’s testing environment. Custom test doubles or integration tests with a real broker (e.g., RabbitMQ) may be needed.
  • Monitoring Gaps: Lack of built-in integration with Laravel’s monitoring tools (e.g., Horizon, Sentry). Teams will need to implement custom metrics (e.g., queue depth, job failures) or use Enqueue’s monitoring plugins (e.g., enqueue/statsd).

Key Questions

  1. Feature Parity:
    • Does the application require Enqueue-specific features (e.g., priority queues, delayed jobs) that Laravel’s native queue system lacks? If not, is the overhead of SimpleClient justified?
    • Are there existing Laravel packages (e.g., spatie/laravel-queue-scheduler) that provide similar functionality with lower complexity?
  2. Broker Compatibility:
    • Is the target broker (e.g., RabbitMQ, Redis) fully supported by Enqueue’s transport adapters? Are there known issues with the broker’s specific configuration (e.g., TLS, clustering)?
    • How will the team handle broker-specific optimizations (e.g., RabbitMQ prefetch count, Redis persistence)?
  3. Performance Trade-offs:
    • What is the expected performance impact of the SimpleClient facade compared to direct broker interactions (e.g., php-amqplib)? Are there benchmarks for Laravel-specific workloads?
    • How will the package handle high-throughput scenarios (e.g., 10,000+ jobs/sec)? Are there bottlenecks in message serialization/deserialization?
  4. Failure Modes:
    • What is the strategy for handling broker failures (e.g., network partitions, broker crashes)? Does the package support automatic failover to a secondary broker?
    • How will job failures be logged and alerted? Does the package integrate with Laravel’s logging (monolog) or error tracking (e.g., Sentry)?
  5. Long-Term Maintenance:
    • Who will maintain the integration between SimpleClient and Laravel (e.g., updates to the Enqueue Laravel bridge, dependency upgrades)?
    • Is the team prepared to contribute to or sponsor the Enqueue project for critical bug fixes or feature requests?
  6. Security:
    • How will broker credentials (e.g., RabbitMQ passwords, Redis URLs) be secured? Does the package support Laravel’s .env or vault-based secrets management?
    • Are there vulnerabilities in the underlying dependencies (e.g., php-amqplib, symfony/config) that could affect the application?

Integration Approach

Stack Fit

  • Laravel Queue Drivers:
    • Register SimpleClient as a custom queue driver in config/queue.php:
      'connections' => [
          'enqueue' => [
              'driver' => 'enqueue',
              'client' => \Enqueue\Client\SimpleClient::class,
              'config' => [
                  'dsn' => env('QUEUE_CONNECTION_DSN', 'amqp://guest:guest@localhost:5672/%2f'),
                  'transport' => env('QUEUE_TRANSPORT', 'amqp'), // 'amqp', 'redis', 'fs', etc.
              ],
          ],
      ],
      
    • Use the enqueue driver in job dispatching:
      dispatch(new ProcessOrder($order))->onQueue('enqueue');
      
  • Symfony Messenger:
    • If using Symfony’s Messenger component (e.g., in a Laravel microservice), the SimpleClient can act as a transport bridge:
      $transport = new \Enqueue\Symfony\Transport\SymfonyTransport(
          new SimpleClient(),
          'amqp://user:pass@localhost:5672/%2f'
      );
      $bus = new \Symfony\Component\Messenger\MessageBus([
          new \Symfony\Component\Messenger\Handler\HandlersLocator([...]),
          new \Symfony\Component\Messenger\Transport\Serialization\Serializer(),
      ]);
      
  • Laravel Service Providers:
    • Extend Laravel’s QueueServiceProvider to bind the SimpleClient and its dependencies:
      public function register()
      {
          $this->app->singleton(\Enqueue\Client\SimpleClient::class, function ($app) {
              $config = $app['config']['queue.connections.enqueue'];
              return new SimpleClient($config['dsn'], $config['transport'] ?? 'amqp');
          });
      }
      
  • Job Serialization:
    • Implement custom serializers for Laravel jobs to ensure compatibility with Enqueue’s Message class:
      use Enqueue\Client\Message;
      
      class LaravelJobSerializer implements \Enqueue\Client\Serializer
      {
          public function serialize($data): string
          {
              return serialize($data);
          }
      
          public function deserialize(string $data): array
          {
              return unserialize($data);
          }
      }
      

Migration Path

  1. Phase 1: Pilot with Non-Critical Jobs

    • Migrate a subset of background jobs (e.g., sending welcome emails, generating reports) to use the enqueue driver.
    • Validate integration by comparing job success/failure rates, execution times, and resource usage against the default queue driver.
    • Tools: Use Laravel’s queue:failed-table and Enqueue’s enqueue:failed to monitor failures.
  2. Phase 2: Incremental Driver Adoption

    • Update job classes to specify the `
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.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
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