arquivei/events-sender

Applications events sender

v3.3.0 2023-09-05 18:38 UTC

README

Applications events sender

Install

composer require arquivei/events-sender

Usage

Create your exporter and pass for Sender class

You can use the entities schemas:

<?php

$exporter = new \Arquivei\Events\Sender\Exporters\File('filePath');

$sender = new \Arquivei\Events\Sender\Sender($exporter);

/**
 * @param \Arquivei\Events\Sender\Schemas\ClassicSchema $schema
 * @param string $stream
 */
$sender->push($schema, $stream);
<?php

$exporter = new \Arquivei\Events\Sender\Exporters\File('filePath');

$sender = new \Arquivei\Events\Sender\Sender($exporter);

/**
 * @param \Arquivei\Events\Sender\Schemas\LatestSchema $schema
 * @param string $stream
 */
$sender->push($schema, $stream);

Or use the factories:

<?php

$exporter = new \Arquivei\Events\Sender\Exporters\File('filePath');

$sender = new \Arquivei\Events\Sender\Sender($exporter);

/**
 * @param \Arquivei\Events\Sender\Factories\LatestSchemaFactory $schema
 * @param string $stream
 */
$sender->push($schema, $stream);
<?php

$exporter = new \Arquivei\Events\Sender\Exporters\File('filePath');

$sender = new \Arquivei\Events\Sender\Sender($exporter);

/**
 * @param \Arquivei\Events\Sender\Factories\ClassicSchemaFactory $schema
 * @param string $stream
 */
$sender->push($schema, $stream);

Important

  • Pass your exporters in order to, if the first one fails, the second be called.
  • To call only one exporter configure only one of them.

Run Tests

$ vendor/phpunit/phpunit/phpunit tests