• 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

Composer Warning: openssl extension is missing. How to enable in WAMP

how to upload binary image to sql server using php laravel

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

PHP each() function replacement

Laravel dosen't connect with Oracle

Clear javascript source cache laravel 5.8

merging two arrays with specified index

carbon generated datetime not stored correctly into the database

echo language construct is discouraged. (PHP)

Yii2: How do I debug console commands?

PHP file_get_contents function

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Laravel set default language not working

PHP - installing Xdebug on Mac with XAMPP (Unix File)

About Contact Privacy policy Terms and conditions