PHP code example of russsiq / laravel-env-manager

1. Go to this page and download the library: Download russsiq/laravel-env-manager 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/ */

    

russsiq / laravel-env-manager example snippets


Russsiq\EnvManager\EnvManagerServiceProvider::class,

'EnvManager' => Russsiq\EnvManager\Support\Facades\EnvManager::class,

EnvManager::someMethod(example $someParam);

use Russsiq\EnvManager\Facades\EnvManager;

// Если файл не существует.
if (! EnvManager::fileExists()) {

    // Создаем новый файл из образца.
    EnvManager::newFromPath(base_path('.env.example'))
        // Попутно генерируем ключ для приложения.
        ->withNewAppKey()
        // Устанавливаем необходимые значения.
        ->setMany([
            'APP_NAME' => 'Example site',
            'APP_LOCALE' => 'ru',
            'APP_URL' => url('/'),
            'MAIL_FROM_ADDRESS' => '[email protected]',
            'MAIL_FROM_NAME' => 'Example',
        ])
        // Сохраняем новый файл в корне как `.env`.
        ->save();
}

// Распечатаем для примера
dump(EnvManager::get('APP_NAME')); // -> `Example site`