• 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

getting error while enter Command => php artisan route:list

Using PHP to connect to a remote MSSQL database

How to get unique slug to same post-title for other time too?

Using spatie/media-library, how to rename a collection of uploaded files?

Yii2: How to download backup files using spanjeta/yii2-backup?

The "client_reference_id" argument is not passed

php echo xml documents with header

PHP Imap , php 7.4.3 on mac osx catalina

How to convert binary string to normal string in php

api response laravel doesn't show

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

How do I refresh a DIV content?

Confirm Leave on External Links in Wordpress

Laravel You requested 1 items, but there are only 0 items available

Problems getting instance of UploadedFile in Yii2

About Contact Privacy policy Terms and conditions