• 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 downgrade or install a specific version of Composer?

Get image type from base64 encoded src string

Store / Website Column in Magento 2 Admin Grid - Custom Module

How do I get friend list from Friends table with counts of friends of my friends

OctoberCMS / Anonymous Global Scope

PHP array slice from position + attempt to return fixed number of items

How to prevent phpmailer sending embedded image as an attachment on Gmail?

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

Access denied for user 'homestead'@'localhost' (using password: YES)

how to insert data into select2 search input after scan using qrcode

How can i hide dt if dd got empty value

How to get company posts from LinkedIn via API?

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

Xdebug can't connect back to Docker host

Laravel unique validation on multiple columns

About Contact Privacy policy Terms and conditions