---
title: "Events — Certificates for Laravel | Roundly"
description: "Seven lifecycle events — requested, issued, failed, renewed, expiring, revoked and expired — each carrying the registry model."
url: https://roundly-consulting.com/open-source/docs/certificates-for-laravel/events
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Certificates for Laravel](https://roundly-consulting.com/open-source/docs/certificates-for-laravel.md)

# Events

Every event lives in RoundlyConsulting\\Certificates\\Events and carries the Eloquent registry model as $certificate. Listen to them instead of polling:

| Event | Payload | Dispatched when |
| --- | --- | --- |
| `CertificateRequested` | $certificate | The registry row is upserted as requested, before provisioning. |
| `CertificateIssued` | $certificate | Provisioning succeeded and the row is issued — on kubernetes, once certificates:sync sees the certificate issued. |
| `CertificateFailed` | $certificate, string $reason | An issuance or renewal failed — the provider threw, reported the certificate failed, expired or revoked, or a renewal returned the same certificate (without a fingerprint: no later expiry) — or certificates:sync sees an existing row failed; the row is failed. |
| `CertificateRenewed` | $certificate | A renewal finished and the row is renewed — also certificates:sync, once a renewing row’s provider holds a new certificate. |
| `CertificateExpiring` | $certificate, int $daysUntilExpiry | Certificates::renewDue() (and so certificates:renew without a domain) and certificates:check, per certificate; daysUntilExpiry is negative once it has expired. |
| `CertificateRevoked` | $certificate, ?string $reason | Certificates::revoke(). |
| `CertificateExpired` | $certificate | Certificates::expire(). |

```php
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Certificates\Events\CertificateExpiring;
use RoundlyConsulting\Certificates\Events\CertificateFailed;
use RoundlyConsulting\Certificates\Events\CertificateIssued;

Event::listen(function (CertificateIssued $event): void {
    logger()->info('issued', ['domain' => $event->certificate->domain]);
});

Event::listen(function (CertificateFailed $event): void {
    // $event->reason — the provider's error message
});

Event::listen(function (CertificateExpiring $event): void {
    // $event->daysUntilExpiry
});
```

certificates:sync fires CertificateIssued, CertificateRenewed and CertificateFailed when it settles a row that was still in flight — on the default kubernetes driver that is how issuance events reach you; rows it discovers or revives fire nothing.

CertificateFailed, CertificateRevoked and CertificateExpired also feed the built-in alert listener when alerts.enabled is true (see Expiry monitoring). Certificates::fake() does not dispatch events.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/certificates-for-laravel.md)
