Weave 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
Laravel Tactician

Laravel Tactician Laravel Package

tillkruss/laravel-tactician

Laravel integration for the Tactician command bus, letting you dispatch commands to handler classes through Laravel's container. Includes a service provider, facade, and config for mapping commands to handlers and middleware.

View on GitHub
Deep Wiki
Context7

Laravel Tactician integrates the League\Tactician command bus into Laravel, giving you a clean way to organize application logic around commands and handlers. It wires the command bus into Laravel’s service container, so handlers and dependencies are resolved automatically.

  • Container-aware command bus resolution
  • Automatic command-to-handler mapping
  • Support for Tactician middleware
  • Laravel service provider integration
  • Simple command dispatching from anywhere in your app
Frequently asked questions about Laravel Tactician
How do I install tillkruss/laravel-tactician in a Laravel app?
Install it with Composer by running composer require tillkruss/laravel-tactician. Because the package targets Laravel 5, you typically register its service provider in the providers array of config/app.php if your app version does not support package auto-discovery. Publish the package configuration if you want to customize the command-to-handler mapping. After that you can resolve the command bus from the container and start dispatching commands.
Which Laravel versions does this package support?
Laravel Tactician was built as an implementation of the Tactician command bus for Laravel 5. It is not advertised as supporting later major versions, so applications on Laravel 6 and above should expect to adapt the service provider or look at Laravel's native bus instead. If you are maintaining a Laravel 5 project, it fits naturally into the existing container and service provider conventions.
How does Laravel Tactician map commands to handlers?
The package registers handler mappings with the Tactician command bus through its service provider, so each command class points at a corresponding handler class. You define those pairs in the package configuration rather than wiring them up by hand in every controller. When a command is dispatched, the bus looks up the mapped handler and invokes it with the command object.
How do I dispatch a command from a controller?
Inject or resolve the command bus and call dispatch with a command object, for example $bus->dispatch(new CreateUser($data)). The controller stays thin because the actual work happens in the mapped handler class. This keeps HTTP concerns separate from domain logic and makes the operation easier to reuse from console commands, jobs, or tests.
Does Laravel Tactician support middleware on the command bus?
Yes. Tactician is middleware-driven at its core, and this package lets you register middleware that wraps every command dispatched through the bus. That makes it a good place for cross-cutting concerns such as transactions, logging, authorization checks, or validation. Middleware runs in the order you configure it, so you can control the pipeline explicitly.
Can I queue commands with Laravel Tactician?
The package includes support for queued commands, so a command can be pushed onto Laravel's queue and handled asynchronously instead of running in the current request. This is useful for slow or side-effect-heavy operations such as sending email or syncing with external APIs. You still map the command to a handler, but execution happens in a queue worker.
How do I test commands and handlers built with Laravel Tactician?
Unit test handlers directly by instantiating them with mocked dependencies and calling the handle method with a command object; no bus is required for that. For integration coverage, dispatch the command through the resolved bus inside a Laravel test case and assert on the resulting database state or interactions. Middleware can be tested by asserting it runs around the handler, which is handy for transaction or logging middleware.
Is tillkruss/laravel-tactician still maintained for production use?
The package is scoped to Laravel 5 and the underlying Tactician library, so it is best treated as a stable but older solution rather than an actively evolving one. Before adopting it, check the repository's recent commit history and issue activity to judge current maintenance. Existing Laravel 5 applications can use it in production, but new projects on modern Laravel should prefer the framework's built-in bus.
How does Laravel Tactician compare to Laravel's built-in command bus and jobs?
Laravel's native bus resolves handlers through the container and offers queueing, middleware-like job middleware, and events out of the box. Laravel Tactician instead wires the standalone Tactician library into Laravel, giving you its explicit command-to-handler mapping and middleware pipeline. The practical difference is mostly philosophy: Tactician favors a strict, configurable bus, while the native bus favors convention and framework integration.
Do I need to register every handler manually, or is there auto-resolution?
With Laravel Tactician you define the command-to-handler mapping, usually in the package configuration file, and the service provider registers those pairs on the bus. That explicit list is a feature for larger codebases because it makes the command surface visible and avoids magic resolution. If you add a new command, remember to add its handler mapping so the bus can find it.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo