laravel-environment

Laravel 5 configuration - environments and overriding

ε祈祈猫儿з 提交于 2019-12-19 05:16:55
问题 I installed fresh Laravel 5 copy. My detectEnvironment function is defined this way: $app->detectEnvironment(function() { return 'local'; return getenv('APP_ENV') ?: 'production'; }); In config\local I've created database.php file: <?php return [ 'nothing' => 'new', ]; I run php artisan clear-compiled . My index method of WelcomeController is defined this way: public function index(Application $app) { echo $app->environment(); var_dump($app['config']['database']); //echo $app['config'][

What's the correct way to set ENV variables in Laravel 5?

故事扮演 提交于 2019-12-17 15:25:27
问题 In laravel 4 we had: $env = $app->detectEnvironment(array( 'local' => array('homestead') )); by default. But in laravel 5 it's changed to: $env = $app->detectEnvironment(function() { return getenv('APP_ENV') ?: 'production'; }); Also, they have excluded .env.* line in .gitignore, now it has: .env And added file .env.example: APP_ENV=local APP_KEY=SomeRandomString DB_USERNAME=homestead DB_PASSWORD=homestead So, if i have more than 2 environments, do i have to set all of them in a single .env

Laravel 5.2 is not reading from .env on ubuntu

▼魔方 西西 提交于 2019-12-08 08:50:29
问题 Note: This question is not a duplicate of these questions: Laravel 5.2 not reading env file Laravel 5.2 .env sometimes doesn't load in time I'm getting this error: production.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in /home/coder/.local/share/Trash/files/myblog/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:45 When I tried dd($config['key']); it returns 'null'. Even the

Laravel 5 Dotenv for specific subdomain

别等时光非礼了梦想. 提交于 2019-12-06 04:46:45
问题 I have a few subdomain in my laravel 5 application, each sub domain have a specific configuration, like mail, nocaptcha, etc. how to set .env file to work with my-specific subdomain ? 回答1: Yes, you can use separate .env files for each subdomain so if you use env variables in your config it will work without great modifications. Create bootstrap/env.php file with the following content: <?php $app->detectEnvironment(function () use ($app) { if (!isset($_SERVER['HTTP_HOST'])) { Dotenv::load($app

Laravel 5 Dotenv for specific subdomain

独自空忆成欢 提交于 2019-12-04 11:23:07
I have a few subdomain in my laravel 5 application, each sub domain have a specific configuration, like mail, nocaptcha, etc. how to set .env file to work with my-specific subdomain ? Yes, you can use separate .env files for each subdomain so if you use env variables in your config it will work without great modifications. Create bootstrap/env.php file with the following content: <?php $app->detectEnvironment(function () use ($app) { if (!isset($_SERVER['HTTP_HOST'])) { Dotenv::load($app['path.base'], $app->environmentFile()); } $pos = mb_strpos($_SERVER['HTTP_HOST'], '.'); $prefix = ''; if (

Laravel 5 doesn't read values from dot ENV files

两盒软妹~` 提交于 2019-12-02 18:49:53
问题 I don't know if this question is relevant or not. LARAVEL 5 is still in developmental phase. I have pulled LARAVEL 5 after watching one of the Laracast video about new features in LARAVEL 5. I couldn't resist to wait for its formal release. I named the local environment dot file as .env.local.php . But for some reason I am unable to get the the values from this dot file when using $_ENV['KEY'] . I am quite sure that I have configured the environment correctly. When doing $app->environment()

Laravel 5 doesn't read values from dot ENV files

不羁岁月 提交于 2019-12-02 07:41:46
I don't know if this question is relevant or not. LARAVEL 5 is still in developmental phase. I have pulled LARAVEL 5 after watching one of the Laracast video about new features in LARAVEL 5. I couldn't resist to wait for its formal release. I named the local environment dot file as .env.local.php . But for some reason I am unable to get the the values from this dot file when using $_ENV['KEY'] . I am quite sure that I have configured the environment correctly. When doing $app->environment() shows the correct environment. Has it been changed in LARAVEL 5 the way we get the values from dot files

Laravel 5 configuration - environments and overriding

醉酒当歌 提交于 2019-12-01 03:24:25
I installed fresh Laravel 5 copy. My detectEnvironment function is defined this way: $app->detectEnvironment(function() { return 'local'; return getenv('APP_ENV') ?: 'production'; }); In config\local I've created database.php file: <?php return [ 'nothing' => 'new', ]; I run php artisan clear-compiled . My index method of WelcomeController is defined this way: public function index(Application $app) { echo $app->environment(); var_dump($app['config']['database']); //echo $app['config']['database']; return view('welcome'); } Application was imported this way: use Illuminate\Foundation

What's the correct way to set ENV variables in Laravel 5?

夙愿已清 提交于 2019-11-27 18:00:41
In laravel 4 we had: $env = $app->detectEnvironment(array( 'local' => array('homestead') )); by default. But in laravel 5 it's changed to: $env = $app->detectEnvironment(function() { return getenv('APP_ENV') ?: 'production'; }); Also, they have excluded .env.* line in .gitignore, now it has: .env And added file .env.example: APP_ENV=local APP_KEY=SomeRandomString DB_USERNAME=homestead DB_PASSWORD=homestead So, if i have more than 2 environments, do i have to set all of them in a single .env file now? E.g.: APP_ENV=local DB_PASSWORD=123 APP_ENV=alpha DB_PASSWORD=456 If i would have no .env file