• 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

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

Wordpress wpdb->delete issue

Sum array values

How to debug in WooCommerce 3+

Fatal error: [] operator not supported for strings

Apply filter array/return terms

Target Individual Form Instance/Counter Inside A PHP While Loop

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

array_map triple dimensional array [duplicate]

php script to delete files older than 24 hrs, deletes all files

disable two buttons after clicking another button

PHP block shortcut in Visual Studio Code

How to submit a form when page loads using JavaScript?

How to KeyBy where multiple items have the same key

About Contact Privacy policy Terms and conditions