PHP code example of encodia / laravel-health-env-vars
1. Go to this page and download the library: Download encodia/laravel-health-env-vars 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/ */
encodia / laravel-health-env-vars example snippets
// typically, in a service provider
use Spatie\Health\Facades\Health;
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;
use Encodia\Health\Checks\EnvVars;
Health::checks([
// From Spatie's examples
UsedDiskSpaceCheck::new()
->warnWhenUsedSpaceIsAbovePercentage(70)
->failWhenUsedSpaceIsAbovePercentage(90),
// Many other checks...
/*
* Check that SOME_API_KEY and MAIL_FROM_ADDRESS variables are
* set (no matter in which environment)
*/
EnvVars::new()
->
use Spatie\Health\Facades\Health;
use Encodia\Health\Checks\EnvVars;
Health::checks([
// ...
// (other checks)
// ...
/*
* Check that SOME_API_KEY and MAIL_FROM_ADDRESS variables are
* set (no matter in which environment).
*
* Only in staging, ensure EXTENDED_DEBUG_MODE has been set.
*
* Additionally, only in production,
* ensure BUGSNAG_API_KEY has been set.
*/
EnvVars::new()
->
use Spatie\Health\Facades\Health;
use Encodia\Health\Checks\EnvVars;
Health::checks([
// ...
// (other checks)
// ...
/*
* Check that SOME_API_KEY and MAIL_FROM_ADDRESS variables are
* set (no matter in which environment).
*
* Only in staging, ensure EXTENDED_DEBUG_MODE has been set.
*
* Additionally, only in qa and production environments,
* ensure BUGSNAG_API_KEY has been set.
*/
EnvVars::new()
->
use Encodia\Health\Checks\EnvVars;
use Spatie\Health\Facades\Health;
Health::checks([
EnvVars::new()
// ... other methods ...
->sure that APP_TIMEZONE is set to 'UTC' (no matter which is the current environment)
'APP_TIMEZONE' => 'UTC',
])
->uction, we want to log 'info' events or above
'LOG_LEVEL' => 'info',
// Only if current environment is 'qa' or 'production, we want to store assets to S3
'FILESYSTEM_DISK' => 's3',
]);
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.