spatie/laravel-health
Monitor your Laravel app’s health by registering checks (disk space, etc.) with warning/fail thresholds. Get notified via mail or Slack when checks degrade, and extend with custom checks for proactive alerting.
This check makes sure the tables of your database are not too big. This check supports MySQL and Postgres.
If one of the given tables is bigger than the specific maximum, the check will fail.
You'll need to install the doctrine/dbal package in your project.
composer require doctrine/dbal
Here's how you can register the check.
use Spatie\Health\Facades\Health;
use Spatie\Health\Checks\Checks\DatabaseTableSizeCheck;
Health::checks([
DatabaseTableSizeCheck::new()
->table('your_table_name', maxSizeInMb: 1_000)
->table('another_table_name', maxSizeInMb: 2_000),
]);
To check another database connection, call connectionName()
DatabaseTableSizeCheck::new()->connectionName('another-connection-name'),
How can I help you explore Laravel packages today?