PHP code example of eventdbx / eventdbx-php

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

    

eventdbx / eventdbx-php example snippets


use EventDbx\Client;

$client = new Client([
    'host' => '127.0.0.1',
    'port' => 6363,
    'token' => getenv('EVENTDBX_TOKEN'),
    // 'tenantId' => 'default',
    // 'noNoise' => true, // only when the server allows plaintext
]);

$page = $client->list('person', ['take' => 10]);
$created = $client->create('person', 'p-1', 'person_registered', [
    'payload' => ['name' => 'Ada'],
    'metadata' => ['@source' => 'sdk-demo'],
]);
$client->apply('person', 'p-1', 'person_updated', [
    'payload' => ['status' => 'active'],
]);
$events = $client->events('person', 'p-1');
$verify = $client->verify('person', 'p-1');