• 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

How to display MySQL table using php and edit it in a web browser

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

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

Sum array values of a column within each column of an array with 3 levels

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

php echo remove slashes from url [duplicate]

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Clear javascript source cache laravel 5.8

Get image type from base64 encoded src string

I can't delete my image when it is liked because of the foreign key in mysql

wp_remote_get() not passing authentication

How to increase the PHP upload limits [duplicate]

Artisan, creating tables in database

Store / Website Column in Magento 2 Admin Grid - Custom Module

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

About Contact Privacy policy Terms and conditions