PHPackages                             victormln/laravel-tactician - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. victormln/laravel-tactician

ActiveLibrary[Framework](/categories/framework)

victormln/laravel-tactician
===========================

Laravel implementation of the Tactician Command Bus

1.1.0(5y ago)11761MITPHPPHP &gt;=7.2.0|^8.0CI failing

Since Jun 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/victormln/laravel-tactician)[ Packagist](https://packagist.org/packages/victormln/laravel-tactician)[ RSS](/packages/victormln-laravel-tactician/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Laravel Tactician
=================

[](#laravel-tactician)

Laravel Tactician in an implementation of the Command Bus Tactician by Ross Tuck and based on: joselfonseca/laravel-tactician

[![Build Status](https://camo.githubusercontent.com/09496e4aa6b0b099a2a6815d2ed30d7710c2c9c689238f1c19df7620d7fc55a7/68747470733a2f2f6170692e7472617669732d63692e6f72672f766963746f726d6c6e2f6c61726176656c2d74616374696369616e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/victormln/laravel-tactician)[![Latest Stable Version](https://camo.githubusercontent.com/fe4ae9310cdf1780687a3b45f9172ccf87643d6d6961f7e57845b009b65f336e/68747470733a2f2f706f7365722e707567782e6f72672f766963746f726d6c6e2f6c61726176656c2d74616374696369616e2f76)](//packagist.org/packages/victormln/laravel-tactician)[![Code Coverage](https://camo.githubusercontent.com/67f35a5ba5fef9084dbe09703956c7ffafad8ab837847fb1f009c49cfc73df20/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766963746f726d6c6e2f6c61726176656c2d74616374696369616e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/victormln/laravel-tactician/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9bb243fd69c619bd8a184eddb5c4fe28cec1dffed1febf7b412c23b562b873c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766963746f726d6c6e2f6c61726176656c2d74616374696369616e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/victormln/laravel-tactician/?branch=master)

Installation
------------

[](#installation)

Simply do a composer require:

```
    composer require victormln/laravel-tactician:1.0.*
```

Or add this line to your composer.json file

```
    "victormln/laravel-tactician" : "1.0.*"
```

#### Other

[](#other)

Once the dependencies have been downloaded, add the service provider to your config/app.php file

```
    'providers' => [
        ...
        Victormln\LaravelTactician\Providers\LaravelTacticianServiceProvider::class
        ...
    ]
```

You are done with the installation!

Usage
-----

[](#usage)

To use the command bus you can resolve the bus from the laravel container like so

```
    $bus = app('Victormln\LaravelTactician\CommandBusInterface');
```

Or you can inject it into a class constructor

```
    use Victormln\LaravelTactician\CommandBusInterface;

    class MyController extends BaseController
    {

        /** @var CommandBusInterface */
        private $bus;

        public function __construct(CommandBusInterface $bus)
        {
            $this->bus = $bus;
        }

    }
```

After inject the commandBus, you can dispatch the command as simple as this:

```
    // First parameter expects the command
    $bus->dispatch(new SimpleCommand());
```

**NOTE: This package is build to automatically grab the CommandHandler from the same path as the Command, so you don't have to do anything to bind the two files. But if you want, you can bind the command handler manually calling the addHandler method**

```
    $bus->addHandler('Path\SimpleCommand', 'Path\SimpleCommandHandler');
    $bus->dispatch(new SimpleCommand());
```

For more information about the usage of the tactician command bus please visit

Example
-------

[](#example)

Check out this example of the package implemented in a simple create order command

Bindings
--------

[](#bindings)

You can configure the bindings for the locator, inflector, extractor and default bus publishing the config file like so

```
    php artisan vendor:publish --provider="Victormln\LaravelTactician\Providers\LaravelTacticianServiceProvider"
```

Then you can modify each class name and they will be resolved from the laravel container

```
    return [
        // The locator to bind
        'locator' => 'Victormln\LaravelTactician\Locator\LaravelLocator',
        // The inflector to bind
        'inflector' => 'League\Tactician\Handler\MethodNameInflector\HandleInflector',
        // The extractor to bind
        'extractor' => 'League\Tactician\Handler\CommandNameExtractor\ClassNameExtractor',
        // The bus to bind
        'bus' => 'Victormln\LaravelTactician\Bus'
    ];
```

Generators
----------

[](#generators)

You can generate Commands and Handlers automatically using artisan

```
artisan make:tactician:command Foo
artisan make:tactician:handler Foo

```

This will create FooCommand and FooCommandHandler and place them in the app/CommandBus/Commands and app/CommandBus/Handlers respectively

To run both at once

```
artisan make:tactician Foo

```

Middleware included
-------------------

[](#middleware-included)

Laravel tactician includes some useful middleware you can use in your commands

- Database Transactions: This Middleware will run the command inside a database transaction, if any exception is thrown the transaction won't be committed and the database will stay intact, you can find this middleware in `Victormln\LaravelTactician\Middleware\DatabaseTransactions`.

Change log
----------

[](#change-log)

Please see the releases page

Tests
-----

[](#tests)

To run the test in this package, navigate to the root folder of the project and run

```
    composer install
```

Then

```
    vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email jose at ditecnologia dot com instead of using the issue tracker.

Credits
-------

[](#credits)

- Based on [Jose Luis Fonseca - LaravelTactician](https://github.com/joselfonseca/laravel-tactician)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](license.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~177 days

Total

4

Last Release

1981d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

1.1.0PHP &gt;=7.2.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13024831?v=4)[Víctor Molina](/maintainers/victormln)[@victormln](https://github.com/victormln)

---

Top Contributors

[![victormln](https://avatars.githubusercontent.com/u/13024831?v=4)](https://github.com/victormln "victormln (51 commits)")[![joselfonseca](https://avatars.githubusercontent.com/u/2046653?v=4)](https://github.com/joselfonseca "joselfonseca (50 commits)")[![timbroder](https://avatars.githubusercontent.com/u/121503?v=4)](https://github.com/timbroder "timbroder (5 commits)")[![jeffagostinho](https://avatars.githubusercontent.com/u/6639259?v=4)](https://github.com/jeffagostinho "jeffagostinho (3 commits)")[![jcrowe206](https://avatars.githubusercontent.com/u/928788?v=4)](https://github.com/jcrowe206 "jcrowe206 (1 commits)")

---

Tags

commandcommand-buscommand-handlerlaraveltacticianlaravelcommand bustacticianlaravel-tactician

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/victormln-laravel-tactician/health.svg)

```
[![Health](https://phpackages.com/badges/victormln-laravel-tactician/health.svg)](https://phpackages.com/packages/victormln-laravel-tactician)
```

###  Alternatives

[league/tactician-bundle

Bundle to integrate Tactician with Symfony projects

24810.1M18](/packages/league-tactician-bundle)[hemp/presenter

Easy Model Presenters in Laravel

247592.6k1](/packages/hemp-presenter)[mikemix/tactician-module

Laminas/Mezzio Module to use the League of Extraordinary Packages' Tactician library - flexible command bus implementation

17156.2k](/packages/mikemix-tactician-module)[rahulalam31/laravel-abuse-ip

Block ip address of all spammer's around the world.

27431.5k](/packages/rahulalam31-laravel-abuse-ip)[cherif/yii2-tactician

Yii2 component for Tactician command bus library

201.8k1](/packages/cherif-yii2-tactician)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
