spatie/laravel-backup
Spatie Laravel Backup creates zip backups of your app files and database, storing them on any Laravel filesystem (even multiple). Includes health monitoring, notifications, and automatic cleanup of old backups. Run with php artisan backup:run.
You can create your own custom health check by letting a class extend Spatie\Backup\Tasks\Monitor\HealthCheck.
That base class contains one abstract method that you should implement.
public function checkHealth(BackupDestination $backupDestination);
If your check determines that the backup is not healthy it should throw a Spatie\Backup\Exceptions\InvalidHealthCheck exception. The HealthCheck base class contains three helpful methods that helps you do this.
fail($message): will throw the right exception under the hood.failIf(bool $condition, string $message): will throw the right exception if $condition is truefailUnless(bool $condition, string $message): will throw the right exception if $condition is falseYou should register your custom health check in the health_checks key of the backup.php config file.
To see an example of a HealthCheck, go read the could of the MaximumAgeInDays and MaximumStorageInMegabytes health checks that are provided by the package.
How can I help you explore Laravel packages today?