PHP code example of sarfraznawaz2005 / servermonitor
1. Go to this page and download the library: Download sarfraznawaz2005/servermonitor 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/ */
sarfraznawaz2005 / servermonitor example snippets
// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('servermonitor:check')->hourly();
}
use Sarfraznawaz2005\ServerMonitor\ServerMonitor;
$sm = new ServerMonitor();
$checkResults = $sm->getChecks();
dump($checkResults);
use Sarfraznawaz2005\ServerMonitor\Checks\Check;
class MyCheck implements Check
{
/**
* Perform the actual verification of this check.
*
* @param array $config
* @return bool
*/
public function check(array $config): bool
{
return 1 === 1;
}
/**
* The error message to display in case the check does not pass.
*
* @return string
*/
public function message(): string
{
return "This error message that users see if check returns false.";
}
}