PHP code example of wallsfantasy / event-store-laravel-package

1. Go to this page and download the library: Download wallsfantasy/event-store-laravel-package library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wallsfantasy / event-store-laravel-package example snippets




use Camuthig\EventStore\Package\EventStoreManager;
use Prooph\EventStore\EventStore;
use Prooph\EventStore\Pdo\MySqlEventStore;

class MyController
{
    public function __construct(EventStore $eventStore, MySqlEventStore $mySqlEventStore, EventStoreManager $eventStoreManager) 
    {
        // The EventStore interface will be bound to the "default" store
        $eventStore->fetchCategoryNames(null);
        
        // Each event store is also bound to the class it is an instance of
        $mySqlEventStore->fetchCategoryNames(null);
        
        // The EventStoreManager is also bound into the application
        
        // The default event store can be retrieved from the EventStoreManager
        $eventStoreManager->store()->fetchCategoryNames(null);
        
        // Or you can fetch any store by name
        $eventStoreManager->store('postgres')->fetchCategoryNames(null);
        
        // Or you can work wih the manager by facade
        \Camuthig\EventStore\Package\Facade\EventStore::store()->fetchCategoryNames(null);
    }
}

[
    App\EventStore\Plugins\MyPlugin::class,
]


[
    App\EventStore\Enrichers\MyEnricher::class,
]