PHP code example of codegenie-be / laravel-env-guard
1. Go to this page and download the library: Download codegenie-be/laravel-env-guard 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/ */
codegenie-be / laravel-env-guard example snippets
'reference_files' => [
'.env.contract',
],
'discover_environment_files' => false,
'compare_files' => [
'.env.testing',
'.env.production',
],
// config/services.php
return [
'acme' => [
'token' => env('ACME_TOKEN'),
],
];
// app/Services/AcmeClient.php
$token = config('services.acme.token');
// app/Services/AcmeClient.php
$token = env('ACME_TOKEN');
'enabled' => true,
'environments' => [
'local',
],
'console_only' => true,
'fail_on_error' => true,
// config/env-guard.php
'environments' => [
'local',
'testing',
],
'console_output' => false,
'suppress_inactive_laravel_keys' => false,
env('SERVICE_'.$driver);
env($key);
getenv('SERVICE_TOKEN');
$_ENV['SERVICE_TOKEN'];
$_SERVER['SERVICE_TOKEN'];
'ignore_keys' => [
'EXTERNAL_PLATFORM_TOKEN',
],
'ignore_patterns' => [
'/^SAIL_/',
'/^FORWARD_/',
],
'max_file_size' => 1_048_576,
return [
'enabled' => true,
'environments' => ['local'],
'console_only' => true,
'fail_on_error' => true,
'console_output' => true,
'suppress_inactive_laravel_keys' => true,
'reference_files' => [],
'compare_files' => [],
'discover_environment_files' => true,
'scan_paths' => [
'app',
'bootstrap',
'config',
'database',
'routes',
'resources',
'tests',
],
'project_files' => [
'composer.json',
'package.json',
'phpunit.xml',
'phpunit.xml.dist',
'public/index.php',
'vite.config.js',
'vite.config.mjs',
'vite.config.cjs',
'vite.config.ts',
'vite.config.mts',
'vite.config.cts',
'Dockerfile',
'compose.yaml',
'compose.yml',
'docker-compose.yaml',
'docker-compose.yml',
],
'project_directories' => [
'.github/workflows',
'scripts',
'bin',
],
'max_file_size' => 1_048_576,
'known_external_keys' => [
'BCRYPT_ROUNDS',
'BROADCAST_CONNECTION',
'LARAVEL_ENV_ENCRYPTION_KEY',
'PHP_CLI_SERVER_WORKERS',
'VITE_APP_NAME',
],
'ignore_keys' => [],
'ignore_patterns' => [],
];
bash
php artisan vendor:publish --tag=env-guard-config
xml
<php>
<env name="CACHE_STORE" value="array"/>
</php>