• 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 contact form configuration [duplicate]

Popup Window and PHP form

Custom add to cart button URL for specific product in WooCommerce?

Laravel: Create morphs() relationship nullable

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Not able to override collapsible.js in magento 2

Spam Filter in Contact Form

Apply filter array/return terms

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

Laravel 5 session not persisting after user is logged in

Download & Save Zoom Recording in directory by PHP

How do I truncate a decimal in PHP?

Minimum order amount except for specific shipping method in WooCommerce

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

About Contact Privacy policy Terms and conditions