• 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 fix bootstrap multiselect search data using ajax

PHP web3 ERC20 token function call

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Laravel passport auth token not working after moving to different server

Could not decode a text frame as UTF-8.

TesseractOCR not working for Laravel

Problems getting instance of UploadedFile in Yii2

Issue with laravel eloquent model property

Unable to match results of php hash_hmac() and coldfusion hmac()

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Webscraping Symfony/Panther: Can't get HTML

Error Class "LaravelFortifyFeatures" not found

Install mysql client in docker image

Form repeater send wrong data with last element in Laravel

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

About Contact Privacy policy Terms and conditions