PHP code example of syamsoul / laravel-set-env

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\Env;

$envService = new Env(); 
$envService->set("MY_APP_NAME", "My Laravel Application");

// or set variable in .env.example file
$envService = new Env('.env.example');
$envService->set("MY_APP_NAME", "Localhost");

$envService = new Env(); 
$the_value = $envService->get("MY_APP_NAME");
// $the_value will return `My Laravel Application`