• 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

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

Hide email address with stars (*)

Display a product custom field only in WooCommerce Admin single orders

How can I access an array/object?

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

How to get unique slug to same post-title for other time too?

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

Cache clear probem in Larave

Laravel s3 upload file with metadata using pre-signed url

Respond with status code 401 on authentication failure using Laravel and Passport?

Project structure for PHP

woocommerce_wp_select options array from product attribute terms

Laravel whole batch is cancelled if one Job fails

SlimExceptionHttpNotFoundException

About Contact Privacy policy Terms and conditions