[ All integrations ](https://ohdear.app/third-party-integrations)

# Health Check Results

PHP package to construct JSON health check reports for Oh Dear's application health monitoring.

[ ohdearapp/health-check-results ](https://github.com/ohdearapp/health-check-results)

by [ Oh Dear ](https://ohdear.app)

## Build Health Check Reports for Any PHP Application [\#](#build-health-check-reports-for-any-php-application)

Using Oh Dear you can monitor various aspects of your application and server. The **health-check-results** package helps you build the JSON structure that Oh Dear expects for its Application Health monitoring feature.

## What You Can Monitor [\#](#what-you-can-monitor)

With this package and Oh Dear's Application Health monitoring, you could get alerts when:

- Disk space is running low
- The database is down
- Redis cannot be reached
- Mails cannot be sent
- There are many application errors (via Flare integration)
- A reboot of your app is required
- Any custom health check you define fails

## Installation [\#](#installation)

Install via Composer:

```
<span class="hl-keyword">composer</span> require ohdearapp/health-check-results
```

## Usage [\#](#usage)

Create health check results with specific statuses:

```
<span class="hl-variable">$checkResults</span> = <span class="hl-keyword">new</span> <span class="hl-type">CheckResults</span>(<span class="hl-type">DateTime</span>::<span class="hl-property">createFromFormat</span>(<span class="hl-value">'Y-m-d H:i:s'</span>, <span class="hl-value">'2021-01-01 00:00:00'</span>));

<span class="hl-variable">$checkResult</span> = <span class="hl-keyword">new</span> <span class="hl-type">CheckResult</span>(
    <span class="hl-property">name</span>: <span class="hl-value">'UsedDiskSpace'</span>,
    <span class="hl-property">label</span>: <span class="hl-value">'Used disk space'</span>,
    <span class="hl-property">notificationMessage</span>: <span class="hl-value">'Your disk is almost full (91%)'</span>,
    <span class="hl-property">shortSummary</span>: <span class="hl-value">'91%'</span>,
    <span class="hl-property">status</span>: <span class="hl-type">CheckResult</span>::<span class="hl-property">STATUS_FAILED</span>,
    <span class="hl-property">meta</span>: [<span class="hl-value">'used_disk_space_percentage'</span> => 91]
);

<span class="hl-variable">$checkResults</span>-><span class="hl-property">addCheckResult</span>(<span class="hl-variable">$checkResult</span>);
```

This will output the JSON structure that Oh Dear expects, enabling you to monitor any aspect of your application you need.
