- What is 21torr/task-manager and how does it relate to Laravel?
- 21torr/task-manager is a small wrapper around symfony/messenger that makes it easier to define, dispatch, and handle background tasks in PHP applications. It is published as a Symfony bundle, not a native Laravel package, so using it in Laravel means bridging Symfony Messenger into Laravel's queue layer, for example with a package such as spatie/laravel-messenger. The payoff is a task-centric API with a Task base class, execution logging, and a built-in worker command instead of raw job classes.
- How do I install 21torr/task-manager with Composer?
- Install it with composer require 21torr/task-manager and register the bundle in your Symfony kernel, or wire the service definitions manually if you are integrating it into a Laravel service provider. You will also need symfony/messenger and Doctrine DBAL available, because the package uses Messenger transports and database-backed logging. Check the official docs at the 21TORR documentation site for the exact bundle registration snippet and transport configuration.
- Does 21torr/task-manager work with Laravel 10 or 11, and which PHP version is required?
- The package targets modern stacks, requiring PHP 8.5+ and Symfony 8.1+, which is well ahead of what most Laravel installations run today. Laravel itself does not ship Symfony Messenger as its queue engine, so even on a compatible PHP version you will need an explicit Messenger bridge and careful namespace isolation from Illuminate\Queue. Treat Laravel support as an integration project rather than an out-of-the-box feature.
- How do I define a task with 21torr/task-manager?
- You create a class that extends the package's Task base class, which enforces consistent metadata and lifecycle handling for every task in your application. From version 2 onward this inheritance is mandatory, so existing plain Laravel job classes cannot be reused as-is and must be refactored. Tasks are registered dynamically through Symfony's event system, for example a RegisterTasksEvent, which you can adapt to Laravel's event dispatcher.
- How do I dispatch a task instead of using Laravel's dispatch() helper?
- Instead of Laravel's dispatch() helper or the DispatchesJobs trait, you enqueue work through the bundle's TaskManager service, for example TaskManager::enqueue(). That call hands the task to Symfony Messenger, which routes it over the configured transport such as Doctrine, Redis, or AMQP. In a Laravel codebase you would typically wrap this in a small service or facade so controllers and services stay decoupled from the underlying transport.
- Does 21torr/task-manager store task history in the database?
- Yes, the package writes task execution history to a TaskLog table, with TaskRun records tracking individual runs, which is useful for auditing and debugging failures. You need to create those tables yourself, either through the bundle's schema or by adapting them into Laravel migrations with UUID primary keys. Failed tasks are recorded as exceptions in the log rather than in Laravel's failed_jobs table, so plan how the two error surfaces will be reconciled.
- Can I use 21torr/task-manager with Laravel Horizon and Redis?
- Horizon is built on Redis-backed queues and the bundle supports Redis among its Messenger transports, so the transport layer can align. The complication is that Horizon manages Laravel queue workers, while this package ships its own task-manager:run-worker command, meaning Horizon will not automatically supervise those workers. You either run the bundle's worker under Supervisor alongside Horizon or build a custom bridge, and you should decide that before rollout.
- How do I run task workers for 21torr/task-manager in production?
- Use the bundle's task-manager:run-worker CLI command instead of, or in parallel with, Laravel's queue:work. In production you would supervise it with Supervisor or a container process manager, exactly as you would a Laravel queue worker. Decide early whether this worker replaces queue:work or runs side by side, because running both against the same transport without clear ownership leads to confusing duplicate processing.
- What are the migration risks of moving existing Laravel jobs to 21torr/task-manager?
- The biggest risk is that every task must extend the Task base class, so all existing job classes need refactoring and metadata migration. The switch from ULID to UUIDv7 identifiers may require schema updates and client-side adjustments, and deprecated methods such as TaskLog::getTaskObject() should be replaced with TaskDetailsNormalizer. There is also added database write overhead for task logging plus an asynchronous LogCleaner, so benchmark throughput against Laravel's native job history before committing.
- Is 21torr/task-manager actively maintained, and what alternatives should I consider?
- The bundle is actively maintained, with releases continuing into 2026 and a documented upgrade path across major versions. For a pure Laravel application, native queues with Horizon plus spatie/laravel-messenger or a simple custom task abstraction is usually lower risk than adopting a Symfony bundle. Choose this package when you already rely on Symfony Messenger semantics or share code between Symfony and Laravel services.