• 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

phpseclib 2.0 can not use Composer to create autoload

CSV to PHP class properties

Whats the point of running Laravel with the command 'php artisan serve'?

PHP how to detect if running on arm64 cpu?

How to unlink image from folder?

How to load Codeigniter 4 lang file into an array variable

Error Class "LaravelFortifyFeatures" not found

500 (Internal Server Error) with Laravel & Docker [duplicate]

how to upload binary image to sql server using php laravel

Composer fails with kylekatarnls/update-helper on new homestead

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

Laravel - Browser displays message again when I press back button

Assign output of PHP function to a variable

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

How to submit the custom form data in database in WordPress without plugin using ajax?

About Contact Privacy policy Terms and conditions