PHPackages                             prooph/laravel-package - 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. prooph/laravel-package

ActiveLibrary

prooph/laravel-package
======================

Laravel package for prooph components to get started out of the box with message bus, CQRS, event sourcing and snapshots

v0.5(7y ago)9910.4k9[2 PRs](https://github.com/prooph/laravel-package/pulls)BSD-3-ClausePHPPHP ^7.1

Since Feb 5Pushed 6y ago9 watchersCompare

[ Source](https://github.com/prooph/laravel-package)[ Packagist](https://packagist.org/packages/prooph/laravel-package)[ Docs](http://getprooph.org)[ RSS](/packages/prooph-laravel-package/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (16)Versions (7)Used By (0)

Laravel package for prooph components
=====================================

[](#laravel-package-for-prooph-components)

Overview
--------

[](#overview)

This is a Laravel package for *prooph components* to get started out of the box with message bus, CQRS, event sourcing and snapshots. It uses the `prooph/pdo-event-store` event store however there are more adapters available.

It provides all [service definitions and a default configuration](config "Laravel Package Resources"). This is more like a Quick-Start package. If you want to use the prooph components in production, we recommend to configure the *prooph components* for your requirements. See the [documentation](http://getprooph.org/ "prooph components documentation")for more details of the *prooph components*.

For rapid prototyping we recommend to use our [prooph-cli](https://github.com/proophsoftware/prooph-cli "prooph command line interface") tool.

### Available services

[](#available-services)

- `Prooph\ServiceBus\CommandBus`: Dispatches commands
- `Prooph\ServiceBus\EventBus`: Dispatches events
- `Prooph\ServiceBus\QueryBus`: Allows for querying over a message bus.
- `Prooph\EventStoreBusBridge\TransactionManager`: Transaction manager for service bus and event store
- `Prooph\EventStoreBusBridge\EventPublisher`: Publishes events on the event bus

### Available event stores

[](#available-event-stores)

- `Prooph\EventStore\Pdo\MariaDbEventStore`: MariaDB event store adapter
- `Prooph\EventStore\Pdo\MySqlEventStore`: MySQL event store adapter
- `Prooph\EventStore\Pdo\PostgresEventStore`: PostgreSQL event store adapter

### Available facades

[](#available-facades)

- `CommandBus`: Usage: [https://github.com/prooph/laravel-package/blob/master/examples/command\_bus.php](https://github.com/prooph/laravel-package/blob/master/examples/command_bus.php)
- `EventBus`: Usage: [https://github.com/prooph/laravel-package/blob/master/examples/event\_bus.php](https://github.com/prooph/laravel-package/blob/master/examples/event_bus.php)
- `QueryBus`: Usage: [https://github.com/prooph/laravel-package/blob/master/examples/query\_bus.php](https://github.com/prooph/laravel-package/blob/master/examples/query_bus.php)

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

[](#installation)

You can install `prooph/laravel-package` via Composer by adding `"prooph/laravel-package": "^0.4"`as requirement to your composer.json.

### Service Provider

[](#service-provider)

If you are using Laravel 5.5 or higher the package will automatically register itself. Otherwise you need to add `Prooph\Package\ProophServiceProvider` to your [providers](https://laravel.com/docs/master/providers#registering-providers "Visit Laravel Documentation") array. Then you will have access to the services above.

This package has configuration files which can be configured to your needs.

Deploy the prooph config files to add your configuration for the prooph components.

```
$ php artisan vendor:publish
```

### Database

[](#database)

Setup your [database migrations](https://github.com/prooph/event-store-doctrine-adapter#database-set-up)for the Event Store and Snapshot with:

```
$ php artisan make:migration create_event_stream_table
```

Update the class `CreateEventStreamTable`:

```
class CreateEventStreamTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        \Prooph\Package\Migration\Schema\EventStoreSchema::createSingleStream('event_stream', true);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        \Prooph\Package\Migration\Schema\EventStoreSchema::dropStream('event_stream');
    }
}
```

And now for the snapshot table.

```
$ php artisan make:migration create_snapshot_table
```

Update the class `CreateSnapshotTable`:

```
class CreateSnapshotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        \Prooph\Package\Migration\Schema\SnapshotSchema::create('snapshot');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        \Prooph\Package\Migration\Schema\SnapshotSchema::drop('snapshot');
    }
}
```

Now it's time to execute the migrations:

```
$ php artisan migrate
```

Example
-------

[](#example)

You have only to define your models (Entities, Repositories) and commands / routes. Here is an example config from the [proophessor-do example app](https://github.com/prooph/proophessor-do "prooph components in action").

Define the aggregate repository, command route and event route for `RegisterUser` in `config/prooph.php`.

```
// add the following config in your config/prooph.php under the specific config key
return [
    'event_store' => [
        // list of aggregate repositories
        'user_collection' => [
            'repository_class' => \Prooph\ProophessorDo\Infrastructure\Repository\EventStoreUserCollection::class,
            'aggregate_type' => \Prooph\ProophessorDo\Model\User\User::class,
            'aggregate_translator' => \Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator::class,
            'snapshot_store' => \Prooph\EventStore\Snapshot\SnapshotStore::class,
        ],
    ],
    'service_bus' => [
        'command_bus' => [
            'router' => [
                'routes' => [
                    // list of commands with corresponding command handler
                    \Prooph\ProophessorDo\Model\User\Command\RegisterUser::class => \Prooph\ProophessorDo\Model\User\Handler\RegisterUserHandler::class,
                ],
            ],
        ],
        'event_bus' => [
            'router' => [
                'routes' => [
                    // list of events with a list of projectors
                    \Prooph\ProophessorDo\Model\User\Event\UserWasRegistered::class => [
                        \Prooph\ProophessorDo\Projection\User\UserProjector::class
                    ],
                ],
            ],
        ],
    ],
];
```

Add the service container factories to `config/dependencies.php`.

```
// add the following config in your config/dependencies.php after the other factories
return [
    // your factories
    // Model
    \Prooph\ProophessorDo\Model\User\Handler\RegisterUserHandler::class => \Prooph\ProophessorDo\Container\Model\User\RegisterUserHandlerFactory::class,
    \Prooph\ProophessorDo\Model\User\UserCollection::class => \Prooph\ProophessorDo\Container\Infrastructure\Repository\EventStoreUserCollectionFactory::class,
    // Projections
    \Prooph\ProophessorDo\Projection\User\UserProjector::class => \Prooph\ProophessorDo\Container\Projection\User\UserProjectorFactory::class,
    \Prooph\ProophessorDo\Projection\User\UserFinder::class => \Prooph\ProophessorDo\Container\Projection\User\UserFinderFactory::class,
];
```

Here is an example how to call the `RegisterUser` command:

```
    /* @var $container \Illuminate\Container\Container */

    /* @var $commandBus \Prooph\ServiceBus\CommandBus */
    $commandBus = $container->make(Prooph\ServiceBus\CommandBus::class);

    $command = new \Prooph\ProophessorDo\Model\User\Command\RegisterUser(
        [
            'user_id' => \Rhumsaa\Uuid\Uuid::uuid4()->toString(),
            'name' => 'prooph',
            'email' => 'my@domain.com',
        ]
    );

    $commandBus->dispatch($command);
```

Here is an example how to get a list of all users from the example above:

```
    /* @var $container \Illuminate\Container\Container */
    $userFinder = $container->make(Prooph\ProophessorDo\Projection\User\UserFinder::class);

    $users = $userFinder->findAll();
```

Support
-------

[](#support)

- Ask questions on Stack Overflow tagged with [\#prooph](https://stackoverflow.com/questions/tagged/prooph).
- File issues at .
- Say hello in the [prooph gitter](https://gitter.im/prooph/improoph) chat.

Contribute
----------

[](#contribute)

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License
-------

[](#license)

Released under the [New BSD License](LICENSE.md).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% 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 ~227 days

Total

5

Last Release

2841d ago

PHP version history (2 changes)v0.1PHP ^5.5 || ^7.0

v0.4PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b633be52465d4aa057f04a7dd7ae8e9bb8ad0245c029550252a95eec395f85f4?d=identicon)[prooph](/maintainers/prooph)

---

Top Contributors

[![sandrokeil](https://avatars.githubusercontent.com/u/3597436?v=4)](https://github.com/sandrokeil "sandrokeil (14 commits)")[![lezhnev74](https://avatars.githubusercontent.com/u/10206110?v=4)](https://github.com/lezhnev74 "lezhnev74 (2 commits)")[![ksassnowski](https://avatars.githubusercontent.com/u/5139098?v=4)](https://github.com/ksassnowski "ksassnowski (1 commits)")

---

Tags

laravelpackageintegrationevent sourcingcqrsproophservice-bussnapshots

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/prooph-laravel-package/health.svg)

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

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[proophsoftware/prooph-bundle

Symfony bundle for prooph components to get started out of the box with message bus, CQRS, event sourcing and snapshots

164.3k](/packages/proophsoftware-prooph-bundle)[yansongda/laravel-pay

专注 Alipay/WeChat/Unipay 的 laravel 支付扩展包

1.1k353.2k9](/packages/yansongda-laravel-pay)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)

PHPackages © 2026

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