• 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

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

Attempt to read property "view" on null when sending password reset email

mysql_result is defined but mysql_free_result warns it expected a resource

How to properly start Laravel 8 with Bootstrap & authentication

Calculating Median of an array in PHP

Mobile browsers are adding .html to filename on download

MySQL upgrade causing unexpected results on simple WHERE clauses

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

Transfer data between JavaScript and PHP through JSON

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

PHPMetrics option --excluded-dirs="myfolder" : myfolder dir is not excluded within docker

How to keep value of selected value after form submission?

How to change HTML structure inside WP <head>

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

About Contact Privacy policy Terms and conditions