PHP code example of wwwision / subscription-engine-dcb-adapter
1. Go to this page and download the library: Download wwwision/subscription-engine-dcb-adapter 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/ */
wwwision / subscription-engine-dcb-adapter example snippets
$eventStore = DoctrineEventStore::create($dbalConnection, eventTableName: 'events');
$subscriptionEngine = new SubscriptionEngine(
eventStoreAdapter: new DcbEventStoreAdapter($eventStore),
subscriptionStore: new DoctrineSubscriptionStore($dbalConnection, tableName: 'subscriptions'),
subscribers: Subscribers::fromArray([
Subscriber::create(
id: 'some-projection',
handler: fn (EventEnvelope $eventEnvelope) => print($eventEnvelope->event->type->value),
reset: fn () => print('resetting projection for replay'),
),
Subscriber::create(
id: 'some-process',
handler: fn (EventEnvelope $eventEnvelope) => print('invoking process...'),
runMode: RunMode::FROM_NOW,
setup: fn () => print('setting up process...'),
),
])
);