• 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

echo language construct is discouraged. (PHP)

PHP drop down list using array's and foreach (else and for) code

Pages are working fine on localhost but not running on the hosting server

Access relation of pivot table in Laravel

What is the function of the (new Date()).getTime() in PHP?

Using array_intersect on a multi-dimensional array

ldap is missing from system when installing adldap2 in laravel

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

Target Laravelista is not instantiable

PHP and WebView - Cookie doesn't are the same

MySQL default time format UTC or GMT?

Changing font color in javascript

wordpress : How to specify the cause "This site can’t be reached"

auth pages not getting css in laravel

Explode not working properly with dash

About Contact Privacy policy Terms and conditions