PHP code example of inoovum / neos-eventstore

1. Go to this page and download the library: Download inoovum/neos-eventstore 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/ */

    

inoovum / neos-eventstore example snippets


use Inoovum\Neos\EventStore\Service\EventStoreService;

#[Flow\Inject]
protected EventStoreService $eventStoreService;


// Use the EventStore methods

// Stream events (array of CloudEvents)
$events = $this->eventStoreService->streamEvents('/customer');

// Commit events
$events = [
    [
        'subject' => '/customer',
        'type' => 'added',
        'data' => [
            'firstName' => 'Bruce',
            'lastName' => 'Wayne',
            'emailAddress' => '[email protected]'
        ]
    ],
    [
        'subject' => '/customer',
        'type' => 'added',
        'data' => [
            'firstName' => 'Alfred',
            'lastName' => 'Pennyworth',
            'emailAddress' => '[email protected]'
        ]
    ],
    [
        'subject' => '/customer/fed2902d-0135-460d-8605-263a06308448',
        'type' => 'personalDataChanged',
        'data' => [
            'firstName' => 'Angus',
            'lastName' => 'MacGyer',
            'emailAddress' => '[email protected]'
        ]
    ]
];
$this->eventStoreService->commitEvents($events);

// Use the EventStore status methods
$this->eventStoreService->audit();
$this->eventStoreService->ping();