Skip to content

Event Reference

Billmora's core engine dispatches events at key moments throughout the application lifecycle. Module plugins can subscribe to these events via getSubscribedEvents() to react in real-time — without modifying any core code.

Each event is a simple PHP class with public readonly properties that expose the relevant Eloquent model(s).


How to Subscribe

In your module's main class, map event classes to handler methods:

php
public function getSubscribedEvents(): array
{
    return [
        \App\Events\Invoice\Paid::class => 'onInvoicePaid',
    ];
}

public function onInvoicePaid(\App\Events\Invoice\Paid $event): void
{
    $invoice = $event->invoice;
    // React to the event...
}

Invoice Events

EventClassPropertiesDispatched When
CreatedApp\Events\Invoice\CreatedInvoice $invoice, bool $sendEmailA new invoice is generated.
GeneratedApp\Events\Invoice\GeneratedInvoice $invoiceAn invoice is auto-generated by the billing cycle.
PaidApp\Events\Invoice\PaidInvoice $invoiceAn invoice is marked as paid.
OverdueApp\Events\Invoice\OverdueInvoice $invoiceAn invoice passes its due date without payment.
RefundedApp\Events\Invoice\RefundedInvoice $invoiceAn invoice is refunded.

TIP

Invoice\Created includes a $sendEmail boolean flag. When true, Billmora will also dispatch email notifications. Your module can check this flag to avoid sending duplicate notifications.


Order Events

EventClassPropertiesDispatched When
CreatedApp\Events\Order\CreatedOrder $orderA new order is placed by a client.
CancelledApp\Events\Order\CancelledOrder $orderAn order is cancelled.

Payment Events

EventClassPropertiesDispatched When
CapturedApp\Events\PaymentCapturedInvoice $invoice, Plugin $plugin, GatewayCallbackResponse $responseA payment is successfully captured by a gateway.

INFO

PaymentCaptured is primarily used internally by Billmora's core engine to process invoice payments. Module plugins can subscribe to it for logging, analytics, or external integrations — but use Invoice\Paid for simpler payment-complete reactions.


Service Events

EventClassPropertiesDispatched When
CreatedApp\Events\Service\CreatedService $serviceA new service is created (status: pending).
Provisioning ActivatedApp\Events\Service\ProvisioningActivatedService $serviceA service is successfully provisioned and activated.
Provisioning FailedApp\Events\Service\ProvisioningFailedService $serviceProvisioning fails for a service.
Provisioning SuspendedApp\Events\Service\ProvisioningSuspendedService $serviceA service is suspended on the remote provider.
Provisioning UnsuspendedApp\Events\Service\ProvisioningUnsuspendedService $serviceA suspended service is reactivated.
Provisioning TerminatedApp\Events\Service\ProvisioningTerminatedService $serviceA service is terminated on the remote provider.
Provisioning RenewedApp\Events\Service\ProvisioningRenewedService $serviceA service is renewed after payment.
Provisioning ScaledApp\Events\Service\ProvisioningScaledService $serviceA service's resources are scaled/upgraded.

Service Cancellation Events

EventClassPropertiesDispatched When
RequestedApp\Events\ServiceCancellation\RequestedServiceCancellation $cancellationA client requests cancellation of a service.
ApprovedApp\Events\ServiceCancellation\ApprovedServiceCancellation $cancellationAn admin approves a cancellation request.
RejectedApp\Events\ServiceCancellation\RejectedServiceCancellation $cancellationAn admin rejects a cancellation request.

Ticket Events

EventClassPropertiesDispatched When
CreatedApp\Events\Ticket\CreatedTicket $ticketA new support ticket is opened.
RepliedApp\Events\Ticket\RepliedTicket $ticketA reply is posted on a ticket.
AssignedApp\Events\Ticket\AssignedTicket $ticketA ticket is assigned to a staff member.
Status ChangedApp\Events\Ticket\StatusChangedTicket $ticketA ticket's status changes.
ClosedApp\Events\Ticket\ClosedTicket $ticketA ticket is closed.

Transaction Events

EventClassPropertiesDispatched When
CreatedApp\Events\Transaction\CreatedTransaction $transactionA new transaction record is created.

User Events

EventClassPropertiesDispatched When
CreatedApp\Events\User\CreatedUser $userA new user account is created (by admin).
RegisteredApp\Events\User\RegisteredUser $userA user registers via the portal.
UpdatedApp\Events\User\UpdatedUser $userA user's profile is updated.
Billing UpdatedApp\Events\User\BillingUpdatedUser $userA user's billing information is updated.
Password Reset RequestedApp\Events\User\PasswordResetRequestedUser $userA user requests a password reset.
Verification ResentApp\Events\User\VerificationResentUser $userAn email verification is resent.

Since event properties are Eloquent model instances, you can access all relationships:

php
public function onInvoicePaid(\App\Events\Invoice\Paid $event): void
{
    $invoice = $event->invoice;
    $user = $invoice->user;           // The client who owns the invoice
    $items = $invoice->items;         // Invoice line items
    $amount = $invoice->total;        // Total amount
    $currency = $invoice->currency;   // Currency code (e.g., 'USD')
}

public function onServiceActivated(\App\Events\Service\ProvisioningActivated $event): void
{
    $service = $event->service;
    $user = $service->user;           // The client who owns the service
    $package = $service->package;     // The package/product purchased
    $config = $service->configuration; // Service-specific configuration
}