Events | laravel-uptime-monitor | Spatie

 SPATIE

  Laravel Uptime Monitor
=========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-uptime-monitor](https://spatie.be/docs/laravel-uptime-monitor/v3)  Monitoring-ssl-certificates  Events

 Version   v3   v2   v1

 Other versions for crawler [v3](https://spatie.be/docs/laravel-uptime-monitor/v3) [v2](https://spatie.be/docs/laravel-uptime-monitor/v2) [v1](https://spatie.be/docs/laravel-uptime-monitor/v1)

- [ Introduction ](https://spatie.be/docs/laravel-uptime-monitor/v3/introduction)
- [ Postcardware ](https://spatie.be/docs/laravel-uptime-monitor/v3/postcardware)
- [ Requirements ](https://spatie.be/docs/laravel-uptime-monitor/v3/requirements)
- [ Upgrading from a previous version ](https://spatie.be/docs/laravel-uptime-monitor/v3/upgrading-from-v2)
- [ High level overview ](https://spatie.be/docs/laravel-uptime-monitor/v3/high-level-overview)
- [ Installation and setup ](https://spatie.be/docs/laravel-uptime-monitor/v3/installation-and-setup)
- [ Questions &amp; issues ](https://spatie.be/docs/laravel-uptime-monitor/v3/questions-and-issues)
- [ Changelog ](https://spatie.be/docs/laravel-uptime-monitor/v3/changelog)
- [ About us ](https://spatie.be/docs/laravel-uptime-monitor/v3/about-us)

Monitoring uptime
-----------------

- [ Adding and removing sites ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-uptime/getting-started)
- [ Events ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-uptime/events)
- [ Notifications ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-uptime/notifications)

Monitoring ssl certificates
---------------------------

- [ Getting started ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-ssl-certificates/getting-started)
- [ Events ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-ssl-certificates/events)
- [ Notifications ](https://spatie.be/docs/laravel-uptime-monitor/v3/monitoring-ssl-certificates/notifications)

Advanced usage
--------------

- [ Manually modifying monitors ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/manually-modifying-monitors)
- [ Syncing monitors from a file ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/syncing-monitors-from-a-file)
- [ Customizing the uptime check ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/customizing-the-uptime-check)
- [ Customizing notifications ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/customizing-notifications)
- [ Disabling monitors ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/disabling-monitors)
- [ Using your own model ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/using-your-own-model)
- [ Monitoring from multiple locations ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/monitoring-from-multiple-locations)
- [ Sending and verifying a payload ](https://spatie.be/docs/laravel-uptime-monitor/v3/advanced-usage/sending-and-verifying-a-payload)

 Events
======

###  On this page

1. [ CertificateCheckFailed ](#content-certificatecheckfailed)
2. [ CertificateCheckSucceeded ](#content-certificatechecksucceeded)
3. [ CertificateExpiresSoon ](#content-certificateexpiressoon)

These events are fired by a monitor's ssl certificate check.

CertificateCheckFailed
--------------------------------------------------------------------------------------------------------------------------

`Spatie\UptimeMonitor\Events\CertificateCheckFailed`

This event is fired when the certificate check cannot find a certificate or if the certificate is invalid. A certificate is considered invalid if it is expired or it not covering correct domain.

It has the following public properties:

- `$monitor`: the instance of `Spatie\UptimeMonitor\Models\Monitor` that fired the event
- `$reason`: a string explaining why the certificate check failed
- `$certificate`: if a certificate was found, this variable contains an instance of `\Spatie\SslCertificate\SslCertificate`. Refer to the [documentation of `spatie/ssl-certificate`](https://github.com/spatie/ssl-certificate) to learn how to work with this object.

CertificateCheckSucceeded
-----------------------------------------------------------------------------------------------------------------------------------

`Spatie\UptimeMonitor\Events\CertificateCheckSucceeded`

This event is fired after the certificate check finds a valid certificate.

It has the following public properties:

- `$monitor`: the instance of `Spatie\UptimeMonitor\Models\Monitor` that fired of the event
- `$certificate`: if a valid certificate is found, this variable contains an instance of `\Spatie\SslCertificate\SslCertificate`. Refer to the [documentation of `spatie/ssl-certificate`](https://github.com/spatie/ssl-certificate) to learn how to work with this object.

CertificateExpiresSoon
--------------------------------------------------------------------------------------------------------------------------

`Spatie\UptimeMonitor\Events\CertificateExpiresSoon`

This event is fired in addition to `CertificateCheckSucceeded` when the certificate check finds an ssl certificate that is going to expire in the number of days configured in `fire_expiring_soon_event_if_certificate_expires_within_days` or less.

It has these public properties:

- `$monitor`: the instance of `Spatie\UptimeMonitor\Models\Monitor` that fired the event
- `$certificate`: if an expiring certificate is found, this variable contains an instance of `\Spatie\SslCertificate\SslCertificate` Refer to the [documentation of `spatie/ssl-certificate`](https://github.com/spatie/ssl-certificate) to learn how to work with this object.
