• 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

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

WordPress Subquery returns more than 1 row on SELECT

mysql slow on updates for a well optimized query

How to get array values using foreach in laravel

How to put php code inside opening and closing shortcodes

PHP block shortcut in Visual Studio Code

Limit WooCommerce products in cart only from one custom taxonomy

Convert every two values of an associative array into key-value pairs

PHP using str_starts_with for array to exclude same as with wildcard

How to get the total hour from starting time to end time in php

Creating Combinations of Elements

Detect a fetch request in PHP

Laravel views are showing from cache on one server but works fine on other server

How to Display Data in Yajra Datatables Laravel 7?

How to test laravel controller method?

About Contact Privacy policy Terms and conditions