PHP code example of domainflow / event-sourcing-core

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

    

domainflow / event-sourcing-core example snippets


use DomainFlow\EventSourcing\Facade\EventSourcingFacade;
use DomainFlow\EventSourcing\Storage\InMemoryEventStorage;

$facade = new EventSourcingFacade(new InMemoryEventStorage());

$order = new Order();
$order->create($orderId, 'customer-1');
$facade->persist($order);

$reloaded = $facade->load(Order::class, $orderId);