• 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

Explode not working properly with dash

Unable to guess the mime type as no guessers are available Laravel 5.2

Inserting data into SQL Server Db An Invalid direction was specified

How to Display Data in Yajra Datatables Laravel 7?

Laravel: HTML in notification

Malformed MIME header error in Symfony 5.3

Laravel display validation error

Converting IPv6 to IPv4 address in PHP

How to get monthly wise data in laravel

PHP -> Next nearest date defined by array of days in week

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

Pass an image through AJAX [duplicate]

auth pages not getting css in laravel

Auto increment id JSON

Accessors (Getter) & Mutators (Setter) On a Pivot Table in Laravel

About Contact Privacy policy Terms and conditions