• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to change the app environment at run time?

phplaravel


PHP Snippet 1:

dump(config('app.env')); // "testing"

config(['app.env' => 'production']);

dump(config('app.env')); // "production"

PHP Snippet 2:

dump(app()->environment()); // "testing"

app()['env'] = 'production';

dump(app()->environment()); // "production"

PHP Snippet 3:

$this->app['env'] = 'production';

Related Snippets

Wordpress add responsive srcset header image to theme

Transpose csv file data [duplicate]

Laravel Factory not calling callback 'afterCreating'

protect my blog content

Whats the point of running Laravel with the command 'php artisan serve'?

WHM Enabling mod_rewrite

Call to a member function givePermissionTo() on null

Dynamic table in HTML using MySQL and php

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

str_word_count() function doesn't display Arabic language properly

auth pages not getting css in laravel

Sentry + Laravel: how to log an already catched Exception?

Wordpress 'post_type_link' hides permalink

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

loop through an anchor id

About Contact Privacy policy Terms and conditions