PHP code example of spatie / statamic-health

1. Go to this page and download the library: Download spatie/statamic-health library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spatie / statamic-health example snippets


// typically, in a service provider

use Spatie\Health\Facades\Health;
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;

Health::checks([
    UsedDiskSpaceCheck::new()
        ->warnWhenUsedSpaceIsAbovePercentage(70)
        ->failWhenUsedSpaceIsAbovePercentage(90),
]);

Spatie\Health\ResultStores\JsonFileHealthResultStore::class => [
    'disk' => 'local',
    'path' => 'health.json',
],

'widgets' => [
    [
        'type' => 'health_check',
        'check' => \Spatie\Health\Checks\Checks\UsedDiskSpaceCheck::class,
        'width' => 33,
    ],
    ...
],

'statamic' => [
    'enable_dashboard' => false,
]
shell
php artisan vendor:publish --tag="health-config"