• 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

Target class controller does not exist - Laravel 8

Download & Save Zoom Recording in directory by PHP

PHP file_get_contents function

MongoDB Duplicate Documents even after adding unique key

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

Laravel display validation error

PHP function Not Working As Expected From functions.php Include File

Handle error for duplicate entries - PHP/MySQL

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

html-php form submission after validation through JavaScript [closed]

XML to CSV with PHP converter [problem with images grabing]

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

Laravel 8: Array to string conversion while calling route:list

Android Volley getParams() method not getting called for JsonObjectRequest

php retrieve specific data onclick from database in a list format

About Contact Privacy policy Terms and conditions