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

Null Laravel Package

enqueue/null

Null transport for Enqueue/Queue Interop: a no-op queue implementation that doesn’t send messages anywhere. Useful as a mock transport for tests and local development, while keeping the same messaging APIs and configuration style.

View on GitHub
Deep Wiki
Context7

Enqueue Null transport

Frequently asked questions about Null
Can I use enqueue/null in Laravel for local development without a real message broker?
Yes, enqueue/null replaces your Laravel queue connection with a null transport, discarding all messages instantly. Configure it in `config/enqueue.php` by setting the DSN to `null://` or injecting `NullTransportFactory` directly. This is ideal for local testing where you don’t need persistence.
How do I configure enqueue/null in Laravel to work with php-enqueue/laravel-ext?
Update your `config/enqueue.php` to use the null DSN: `'dsn' => env('QUEUE_CONNECTION', 'null://')`. If using dependency injection, replace `TransportFactory` with `NullTransportFactory` in your service provider. The package integrates seamlessly with Laravel’s queue system via the Enqueue extension.
Will enqueue/null work with Laravel’s built-in queue system (e.g., database or sync drivers)?
No, enqueue/null is designed for the Enqueue library only. If you’re using Laravel’s native queue drivers, you’ll need a different mock solution like `laravel-zero-queue` or `mockery` for testing. Ensure your app uses `php-enqueue/laravel-ext` for compatibility.
Is enqueue/null safe for production environments?
Absolutely not. The null transport silently discards all messages, making it unsafe for production. Always validate your environment (e.g., check `APP_ENV !== 'production'`) or use a feature flag to prevent accidental deployment. Consider runtime checks in your deployment pipeline.
How can I test message consumers with enqueue/null in Laravel?
Use enqueue/null for unit tests by mocking the transport in your test cases. For integration tests, verify consumer logic by asserting no messages are processed (since they’re discarded). Pair it with PHPUnit or Pest to validate edge cases like retries or dead-letter queues in isolation.
Does enqueue/null support delayed messages or retry logic?
No, enqueue/null discards all messages immediately, including delayed or retried ones. If your app relies on these features, use a real broker (e.g., Redis or RabbitMQ) for integration tests. Document this limitation in your test suite to avoid subtle bugs.
What Laravel versions and PHP versions does enqueue/null support?
enqueue/null requires **PHP 8.1+** (due to Enqueue v9.x+ dependency) and works with **Laravel 9.x+**. For older Laravel versions, use Enqueue v8.x and ensure compatibility with `php-enqueue/laravel-ext`. Always check the Enqueue library’s version matrix for exact requirements.
How do I switch from enqueue/null back to a real broker (e.g., Redis) in Laravel?
Update your `.env` or `config/enqueue.php` to point to your real broker’s DSN (e.g., `redis://localhost`). No data migration is needed since enqueue/null doesn’t persist messages. Use environment-specific configurations or feature flags to toggle between transports dynamically.
Are there alternatives to enqueue/null for mocking Laravel queues?
For Laravel’s native queues, consider `mockery` or `laravel-zero-queue`. If you’re using Enqueue, alternatives like `enqueue/amqp-ext` (for RabbitMQ) or `enqueue/redis-ext` provide real brokers for testing. However, enqueue/null is the only lightweight mock transport for Enqueue’s abstraction layer.
How can I verify enqueue/null isn’t accidentally used in production?
Add a runtime check in your `AppServiceProvider` or a deployment gate (e.g., in CI/CD) to throw an exception if `NullTransportFactory` is detected in production. Use Laravel’s `config('queue.default')` to enforce broker-specific connections or log warnings during queue operations.
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.
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
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai