1. Go to this page and download the library: Download ejetar/laravel-environment 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/ */
ejetar / laravel-environment example snippets
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromSystemEnvironmentVariable($system_environment_variable_name, $default_value = 'local')
//Loads an environment file according to the value of a system environment variable
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromFile($filename)
//Loads an environment file explicitly, stating the file path
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromCustomMethod(Callable $callable)
//Enables the user to enter a custom method for loading the environment file
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromSystemEnvironmentVariable('MYAPP_ENV');
//Will load the environment file .env.production
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromSystemEnvironmentVariable('MYAPP_ENV');
//Will load the .env.local environment file. When the system environment variable does not exist, then it takes $default_value.
//By default $default_value is set to 'local'.
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromSystemEnvironmentVariable('MYAPP_ENV', 'acme');
//Will load the .env.acme environment file. When the system environment variable does not exist, then it takes $default_value.
\Ejetar\LaravelEnvironment::fromFile('.env.local');
//Load the .env.local file explicitly
\Ejetar\LaravelEnvironment\LaravelEnvironment::fromCustomMethod(function(){
switch($_SERVER['SERVER_ADDR']) {
case '1.2.3.4':
return '.env.local';
break;
case '5.6.7.8':
return '.env.production';
break;
default:
return '.env.other';
}
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.