- How does 21torr/task-manager compare to Laravel’s built-in queue system for task management?
- This package wraps Symfony Messenger, offering structured task lifecycle management (dispatch, execution, logging) with a cleaner API than Laravel’s native queue system. It’s ideal if you need advanced features like event-driven task registration, UUIDv7 tracking, or database-backed audit logs, but requires refactoring existing jobs to extend its `Task` base class.
- Can I use 21torr/task-manager with Laravel Horizon (Redis) for queue workers?
- Yes, but with configuration. The bundle supports multiple transports (Doctrine, AMQP, Redis), so you can integrate it with Horizon by configuring Redis as the transport. However, you’ll need to replace `queue:work` with the bundle’s `task-manager:run-worker` command, which may require adjustments to your deployment workflow.
- What Laravel versions and PHP requirements does 21torr/task-manager support?
- The package requires **Symfony 8.1+** and **PHP 8.5+**, which aligns with Laravel 10+. If you’re on Laravel 9 or earlier, you’ll need to upgrade or use a bridge like `spatie/laravel-messenger` to avoid dependency conflicts. Always check the [README](https://github.com/21TORR/TaskManagerBundle) for the latest compatibility notes.
- How do I migrate existing Laravel jobs to use 21torr/task-manager?
- Refactor your jobs to extend the bundle’s `Task` base class and update dispatch logic to use `TaskManager::enqueue()`. For example, replace `dispatch(new MyJob())` with `TaskManager::enqueue(new MyTask())`. The bundle provides a [migration guide](https://21torr-docs.pages.dev/docs/php/symfony/task-manager/) for schema changes and metadata adjustments.
- Does 21torr/task-manager integrate with Laravel’s failed_jobs table for error tracking?
- No, it uses its own `TaskLog` and `TaskRun` tables for tracking. Failed tasks are logged as exceptions in these tables, but you can sync them with Laravel’s `failed_jobs` by extending the bundle’s `LogCleaner` or writing a custom observer. Check the [documentation](https://21torr-docs.pages.dev/docs/php/symfony/task-manager/) for event listeners to bridge the two systems.
- Are there performance concerns with the additional database logging in 21torr/task-manager?
- Yes, the bundle writes to `TaskLog` and `TaskRun` tables for every task, which adds overhead compared to Laravel’s lightweight queue system. Benchmark your workloads—especially high-throughput apps—and consider disabling logging for non-critical tasks via the `Task` class’s `shouldLog()` method. For production, ensure your database is optimized for write-heavy operations.
- How do I configure 21torr/task-manager to work with Laravel’s service container?
- Bind the `TaskManager` service in your `AppServiceProvider` or use Laravel’s package discovery to auto-register it. For Symfony Messenger components (e.g., `MessageBus`), register them as Laravel services with aliases to avoid conflicts. Example: `$app->singleton('symfony.messenger.bus', fn() => $container->get('bus.default'));` in `config/app.php`.
- What alternatives exist for task management in Laravel if 21torr/task-manager feels too complex?
- For simpler needs, stick with Laravel’s native queue system or use `spatie/laravel-messenger` to bridge Symfony Messenger without refactoring jobs. For advanced workflows, consider `laravel-horizon` (Redis-based) or `spatie/laravel-background-jobs` (for async tasks). If you need event-driven task registration, `spatie/laravel-event-scheduler` offers a lighter alternative.
- How can I extend 21torr/task-manager to add custom task metadata or middleware?
- Use Symfony’s event system via the bundle’s `RegisterTasksEvent` to dynamically register tasks. For middleware, implement Symfony’s `Stamp` interface and bind it to the `TaskManager` bus. Example: `TaskManager::getBus()->addMiddleware(new MyTaskStampMiddleware())`. The [docs](https://21torr-docs.pages.dev/docs/php/symfony/task-manager/) cover customizing task metadata via the `Task` class’s `getMetadata()` method.
- Will 21torr/task-manager work with Laravel’s Scout for task prioritization or retries?
- No, but you can integrate Scout’s features manually. Use Scout’s `searchable` trait for task prioritization and implement retry logic via Symfony’s `RetryStamp` or Laravel’s `ShouldQueue` interface. The bundle’s `TaskRun` table can store retry counts, and you can trigger retries via `TaskManager::retry($taskId)`. Coordinate with your queue worker to handle these cases.