PHPackages                             jagarsoft/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. jagarsoft/laravel-tactician

ActiveLibrary[Framework](/categories/framework)

jagarsoft/laravel-tactician
===========================

Laravel implementation of the Tactician Command Bus

v1.0.9(4y ago)363.2k↓32.1%1MITPHPPHP &gt;=7.4.0

Since Sep 8Pushed 4y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (19)Used By (1)

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

[](#laravel-tactician)

Laravel Tactician in an implementation of the Command Bus Tactician by Ross Tuck.

[![Build Status](https://camo.githubusercontent.com/18866e977e2f0d34274de1dc34fa5fa22478ce6ad8f9770766a2ecccbd7fbf18/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61676172736f66742f6c61726176656c2d74616374696369616e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jagarsoft/laravel-tactician/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/fab51a8fbd6b9e904cd327c84d69e886701cedac593830ad800f22829757dcc5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61676172736f66742f6c61726176656c2d74616374696369616e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jagarsoft/laravel-tactician/?branch=master)[![Packagist Downloads](https://camo.githubusercontent.com/f13d615d78d19b4a8be60e938b51c64014ef3b7891d77d8777344ab38f4bbb8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61676172736f66742f6c61726176656c2d74616374696369616e3f636f6c6f723d626c7565)](https://packagist.org/packages/jagarsoft/laravel-tactician)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/72cb3ffad61e9e8662cbd408940e8386752a9bc77ff759148ea1cd907020787c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61676172736f66742f6c61726176656c2d74616374696369616e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jagarsoft/laravel-tactician/?branch=master)

Warning
-------

[](#warning)

Original package has been *abandoned*. The author has designated this repository as an official replacement. Current tag deprecated Joselfonseca namespace. Next release will be named to Jagarsoft.

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

[](#installation)

To install this update your composer.json run `composer require jagarsoft/laravel-tactician`

#### &gt;= laravel5.5

[](#-laravel55)

ServiceProvider will be attached automatically.

#### Other

[](#other)

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

```
    'providers' => [
        ...
        Joselfonseca\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('Joselfonseca\LaravelTactician\CommandBusInterface');
```

Or you can inject it into a class constructor:

```
    use Joselfonseca\LaravelTactician\CommandBusInterface;

    class MyController extends BaseController
    {

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

    }
```

Once you have the bus instance you can add your handler for the command to be dispatched:

```
    $bus->addHandler('SomeCommand', 'SomeHandler');
```

Now you can dispatch the command with the middleware:

```
    // first parameter is the class name of the command
    // Second parameter is an array of input data to be mapped to the command
    // Third parameter is an array of middleware class names to be added to the stack
    $bus->dispatch('SomeCommand', [], []);
```

You can map the input data array of the Command's *constructor* with a plain list of arguments or the array itself. For example:

```
    // Send parameters in an array of input data ...
    $bus->dispatch('SomeCommand', [
        'propertyOne'   => 'One',
        'propertyTwo'   => 'Two',
        'propertyThree' => 'Three',
    ], []);

    // ... and receive them as individual parameters ...
    Class SomeCommand {
        public function __construct($propertyOne = 'A', $propertyTwo = 'B', $propertyThree = 'C'){
            //...
        }
    }

    // ... or receive array of input data itself
        Class SomeCommand {
            public function __construct(array $data = [
                'propertyOne'   => 'A',
                'propertyTwo'   => 'B',
                'propertyThree' => 'C',
            ]){
                //...
            }
        }
```

Of course, you can use default values!

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 by publishing the config file like so:

```
    php artisan vendor:publish
```

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

```
    return [
        // The locator to bind
        'locator' => 'Joselfonseca\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' => 'Joselfonseca\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 FooHandler and place them in the `app/Commands` folder, please note that the words `Command` and `Handler` will be added to the class names respectively, so in the avobe example the clases created will be `FooCommand` and `FooHandler`.

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 `Joselfonseca\LaravelTactician\Middleware\DatabaseTransactions`.

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

[](#change-log)

Please see the releases page

Tests
-----

[](#tests)

To run the tests 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)

- [Jose Luis Fonseca](https://github.com/joselfonseca)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

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 ~138 days

Recently: every ~304 days

Total

18

Last Release

1554d ago

Major Versions

0.5.0 → v1.0.42021-08-01

PHP version history (3 changes)v0.1.0PHP &gt;=5.5.0

0.4.0PHP &gt;=5.6.0

v1.0.9PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/182835628ad769960900d3733457a633c8e033f4b1b29afa04dd95dca642c76d?d=identicon)[jagarsoft](/maintainers/jagarsoft)

---

Top Contributors

[![joselfonseca](https://avatars.githubusercontent.com/u/2046653?v=4)](https://github.com/joselfonseca "joselfonseca (65 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)")[![kpicaza](https://avatars.githubusercontent.com/u/1093654?v=4)](https://github.com/kpicaza "kpicaza (2 commits)")[![jagarsoft](https://avatars.githubusercontent.com/u/3843371?v=4)](https://github.com/jagarsoft "jagarsoft (2 commits)")[![lloy0076](https://avatars.githubusercontent.com/u/1174532?v=4)](https://github.com/lloy0076 "lloy0076 (1 commits)")[![ralbear](https://avatars.githubusercontent.com/u/3120856?v=4)](https://github.com/ralbear "ralbear (1 commits)")[![jcrowe206](https://avatars.githubusercontent.com/u/928788?v=4)](https://github.com/jcrowe206 "jcrowe206 (1 commits)")

---

Tags

laravelcommand bustacticianlaravel-tactician

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/jagarsoft-laravel-tactician/health.svg)](https://phpackages.com/packages/jagarsoft-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)
