Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Services\Infrastructure\DomainEvents;
use HiEvents\Services\Infrastructure\DomainEvents\Events\BaseDomainEvent;
use Illuminate\Events\Dispatcher as EventDispatcher;
use Psr\Log\LoggerInterface;
use Throwable;
class DomainEventDispatcherService
{
public function __construct(
private readonly EventDispatcher $dispatcher,
private readonly LoggerInterface $logger,
) {}
/**
* @throws Throwable
*/
public function dispatch(BaseDomainEvent $event): void
{
try {
$this->dispatcher->dispatch($event);
} catch (Throwable $e) {
$this->logger->error('Failed to dispatch domain event', ['event' => $event, 'exception' => $e]);
throw $e;
}
}
}