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. |
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; the row is failed. |
CertificateRenewed | $certificate | A renewal finished and the row is renewed. |
CertificateExpiring | $certificate, int $daysUntilExpiry | Certificates::renewDue() (and so certificates:renew without a domain) and certificates:check, per certificate. |
CertificateRevoked | $certificate, ?string $reason | Certificates::revoke(). |
CertificateExpired | $certificate | Certificates::expire(). |
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
});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 cryptoBy donating, you agree to our donation terms.
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.