PHP code example of maslauskas / event-store

1. Go to this page and download the library: Download maslauskas/event-store 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/ */

    

maslauskas / event-store example snippets


composer 

'connections' => [

        /*
        ...
        */

        'eventstore' => [
            'driver' => 'mysql',
            'host' => env('EVENT_STORE_HOST', 'localhost'),
            'port' => env('EVENT_STORE_PORT', '3306'),
            'database' => env('EVENT_STORE_DATABASE', 'event_store'),
            'username' => env('EVENT_STORE_USERNAME', 'root'),
            'password' => env('EVENT_STORE_PASSWORD', 'root'),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

        /*
        ...
        */
]

EventStore::add('event_name', $data);

eventstore()->add('event_name', $data);

'streams' => [
    'user_login_stream' => [
        'user_logged_in',
    ]
]

'throw_exceptions' => true,

php artisan vendor:publish --provider=Maslauskas\EventStore\EventStoreServiceProvider

php artisan migrate