by sarfraznawaz2005

sarfraznawaz2005 / servermonitor

:heartbeat: Laravel package to periodically monitor the health of your server and application.

133 Stars 26 Forks Last release: about 1 month ago (1.9.4) MIT License 125 Commits 45 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Latest Version on Packagist Total Downloads

Laravel Server Monitor

Laravel package to periodically monitor the health of your server and application. It ships with common checks out of the box and allows you to add your own custom checks too. The packages comes with both console and web interfaces.


  • PHP >= 7+
  • Laravel 5+


$ composer require sarfraznawaz2005/servermonitor

Additional step for Laravel < 5.5:

Add Service Provider to


Now publish package's config file by running below command:

$ php artisan vendor:publish --provider="Sarfraznawaz2005\ServerMonitor\ServiceProvider"


config file to customize checks, notifications and more.

Built-in Checks

The package comes with following checks out of the box. Checks can be divided into three categories:

  • Server Checks: Checks that are related to your server only.
  • Common Checks: Checks that are related to your application only but are common in nature irrespective of which environment your application is running on. These checks run on all environments.
  • Environment Checks: Checks that are related to your application only but are limited to specific environment such as production or development.

Server Checks

  • :whitecheckmark: Required PHP extensions are installed
  • :whitecheckmark: Disk Space Enough
  • :whitecheckmark: Average CPU Usage
  • :whitecheckmark: FTP Connection Works
  • :whitecheckmark: SFTP Connection Works
  • :whitecheckmark: SSL Certificate Valid
  • :whitecheckmark: Are servers pingable
  • :whitecheckmark: Check HTTP Status Code
  • :whitecheckmark: Check php.ini file values

Common Checks

  • :whitecheckmark: Correct PHP version installed
  • :whitecheckmark: The environment file exists
  • :whitecheckmark: APP_KEY is set
  • :whitecheckmark: Correct Directory Permissions
  • :whitecheckmark: Database can be accessed
  • :whitecheckmark: Migrations are up to date
  • :whitecheckmark: Composer dependencies up to date
  • :whitecheckmark: Check Composer Packages Security
  • :whitecheckmark: Storage directory is linked
  • :whitecheckmark: The Redis cache can be accessed
  • :whitecheckmark: Mail is Working
  • :whitecheckmark: Cloud Storage Works
  • :whitecheckmark: Config file has correct values

Environment Checks (Development)

  • :whitecheckmark: Debug Mode ON
  • :whitecheckmark: Config Cache OFF
  • :whitecheckmark: Routes Cache OFF

Environment Checks (Production)

  • :whitecheckmark: Debug Mode OFF
  • :whitecheckmark: Config Cache ON
  • :whitecheckmark: Routes Cache ON
  • :whitecheckmark: Unwanted PHP extensions disabled
  • :whitecheckmark: Supervisor programs are running


The package comes with two commands:

  • php artisan servermonitor:check
    Runs all checks enabled in config file and return their new status.
  • php artisan servermonitor:status
    Returns previously-run status of all checks without running new process.

Here is how it looks:

Screen 3

Both commands take optional argument. If specified, it will run check or return status of only specified check:

  • php artisan servermonitor:check AppKeySet
    Runs new check process for check
  • php artisan servermonitor:status AppKeySet
    Returns previous run status for check


You can use

command to check status of enabled checks periodically instead of running this command manually each time.

Schedule it in Laravel's console kernel file accordingly:

// app/Console/Kernel.php
protected function schedule(Schedule $schedule)

Web Interface

The package provides built-in web interface. You can customize the route of web interface in config file

'route' => 'servermonitor'
. Once done, you can visit Web Interface at url
. Replace
with route you used.

Other than commands, you can also use Web Interface to run new checks process for all or individual checks.

Screen 1

Screen 2

Disabling Web Interface

If you would like to disable Web Interface, you can set

and now hitting web interface route would result in 404.

Running/Getting Checks Programmatically

If you still would like to show status of various checks in your view in your own way, you can get status of all checks programmatically like so:

use Sarfraznawaz2005\ServerMonitor\ServerMonitor;

$sm = new ServerMonitor(); $checkResults = $sm->getChecks(); dump($checkResults);

You can also run check(s) programmatically (

), see available methods in file:

Running Checks for Web Only

If for some reasons, you want to run some checks manually and via Web Interface only, you can specify

option for such checks like this:
\Sarfraznawaz2005\ServerMonitor\Checks\Server\RequiredPhpExtensionsAreInstalled::class => [
    'web_only' => true

Now above check will not be run via console when

is run. However this check will be performed when you run all checks via Web Interface.



file for all checks. Note that some checks are commented intentionally, you can un-comment them if you need to use them.

You can also customize check name that displays up in console/web interface by passing

config value like this:
\Sarfraznawaz2005\ServerMonitor\Checks\Application\AppKeySet::class => [
    'name' => 'Check if APP_KEY is set',

If you don't pass

key, it will be made out of class name, in above case
App Key Set
by automatically converting "PascalCase" to "Pascal Case" from class name.

Some checks may require additional config options such as:

\Sarfraznawaz2005\ServerMonitor\Checks\Application\ComposerDependenciesUpToDate::class => [
    'binary_path' => 'composer'

For above check to work, you must provide

value for example.

Alert Configuration

You can get notified when a check fails. Package supports these alert/notification channels:

  • mail
  • log
  • slack
  • pushover

Update your notification options under

option in config file.

Note that you can also customize all notification options for individual checks too. Let's say you have specified

as default channel for your alerts but for following check only, it will be alerted via
channel and a different alert title:
\Sarfraznawaz2005\ServerMonitor\Checks\Application\AppKeySet::class => [
    'notification_channel' => 'log',
    'notification_title' => 'Hello World'

You can also disable alerts for individual checks like so:

\Sarfraznawaz2005\ServerMonitor\Checks\Application\AppKeySet::class => [
    'disable_notification' => true

Creating Your Own Custom Checks

You can create custom checks, by implementing the [

] interface and adding the class to the config file. Example:
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.";



Please let's know if you notice any issues, we recommend PRs for existing or new checks.

No Tests ?

We welcome PRs for test cases.



Please see the license file for more information.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.