PHP code example of michaelesmith / event-data

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

    

michaelesmith / event-data example snippets


$edm = new \MS\EventData\EventDataManager(new \MS\EventData\Storage\File('/tmp/events.txt'));
$edm->addLogger(new \MS\EventData\Logger\GenericLogger());
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));

$edm->setDelayed(true);

$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...

$edm->flush();

$edm->setDebug(true);

$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));

$edm = new \MS\EventData\EventDataManager(new \MS\EventData\Storage\KeenIO($keenClient));
$edm->addLogger(new \MS\EventData\Logger\PSRLogger($monolog, $edm));
$edm->setDebug(DEBUG_MODE);
$edm->setDelayed(true);

...
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...

$edm->flush(); //after the response has been returned to the user