• 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

Laravel-fopen: failed to open stream: Permission denied

PHP 8.1: strftime() is deprecated

Creating command to backup MySql database in Laravel

woocommerce change position of price

(Cache::lock()) -> get() -- Under what conditions does it return false?

Laravel php artisan serve to mimic HTTPS

Auto increment id JSON

phpunit - mockbuilder - set mock object internal property

how can I set a session variable in Drupal 8 and get it in a php script?

Php - Sum up the numbers in an array one by one

Adding custom body class to the custom archive pages

500 Internal Server Error on Ajax request. Not sure the origin of the problem

Laravel Collections. Is there some kind of assertStructure method?

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

MySQL upgrade causing unexpected results on simple WHERE clauses

About Contact Privacy policy Terms and conditions