1. Go to this page and download the library: Download syamsoul/laravel-set-env 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/ */
syamsoul / laravel-set-env example snippets
use SoulDoit\SetEnv\Facades\Env;
// Set/update variable in .env file
Env::set("MY_APP_NAME", "My Laravel Application");
// Set/update variable in .env.example file
Env::envFile('.env.example')->set("MY_APP_NAME", "Localhost");
// Add a comment to explain the variable
Env::set("ENABLE_CLOCKWORK", false, "Enable or disable the clockwork debugging tools");
// Result in .env:
// ENABLE_CLOCKWORK=false #Enable or disable the clockwork debugging tools
// Add/update a key after a specific key
Env::set("ENABLE_CLOCKWORK", false, afterKey: "APP_NAME");
// Result in .env:
// APP_NAME=MyApp
// ENABLE_CLOCKWORK=false
$value = Env::get("MY_APP_NAME");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.