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/v2)  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)

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

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

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

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

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

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

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

      You are viewing the documentation for **an older version** of this package. You can check the version you are using with the following command:

 `                                    composer show spatie/laravel-uptime-monitor                                                                                                                                                                                                                                    `

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.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
