PHPackages                             flyingfoxx/commandcenter - 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. [CLI &amp; Console](/categories/cli)
4. /
5. flyingfoxx/commandcenter

ActiveLibrary[CLI &amp; Console](/categories/cli)

flyingfoxx/commandcenter
========================

Commands and domain events for any framework. Includes a Laravel implementation.

1.2.1(11y ago)152.2kMITPHPPHP &gt;=5.4.0

Since Aug 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/flyingfoxx/commandcenter)[ Packagist](https://packagist.org/packages/flyingfoxx/commandcenter)[ Docs](http://github.com/flyingfoxx/commandcenter)[ RSS](/packages/flyingfoxx-commandcenter/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Flyingfoxx / CommandCenter
==========================

[](#flyingfoxx--commandcenter)

This package provides a framework agnostic architecture for utilizing commands and domain events in your applications. Any of the components can be easily extended for your specific use.

**Laravel implementation is included.**

*inspired and expanded on [Jeffrey Way](https://github.com/JeffreyWay) at [Laracasts](https://github.com/Laracasts)*

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

[](#installation)

Install CommandCenter through Composer.

```
"require": {
    "flyingfoxx/commandcenter": "~1.0"
}
```

### Laravel

[](#laravel)

If using Laravel, update `app/config/app.php` to include the package's service provider.

```
'Flyingfoxx\CommandCenter\Laravel\CommandCenterServiceProvider'
```

**Check out the Laravel section at the end of this document for additional features!**

Usage
-----

[](#usage)

Before getting started, this approach is not recommended for smaller projects where architecture isn't as important. This package helps to structure your business logic, stick to the single responsibility principle, and keep your controllers skinny.

### CommandApplication

[](#commandapplication)

In order to get started, you must register your specific application with CommandCenter by implementing the package's `CommandApplication` interface and registering any bindings. Please use the included Laravel implementation and service provider for reference in other frameworks. The reference classes are below:

- Flyingfoxx\\CommandCenter\\Laravel\\Application
- Flyingfoxx\\CommandCenter\\Laravel\\CommandCenterServiceProvider

### Command

[](#command)

It all starts with a command. A command is an "instruction" you give to your domain to carry out specific actions. It is represented as a simple DTO (data transfer object) that carries the data needed to perform that specific command.

For example, say you need to register a new user. You would then create a `RegisterUserCommand` that would look like this:

```
