• 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

generate an Excel file using PHP

Fatal error: [] operator not supported for strings

Cannot pass null argument when using type hinting

Redirect to previous page with php

How to redirect to another page after n seconds in wordpress without using javascript?

generating a random code in php?

Laravel dosen't connect with Oracle

Auto increment id JSON

Currently Using CodeIgniter Framework i have an Error

How do I do HTTP basic authentication using Guzzle?

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

How to edit Records using CodeIgniter

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Exact alternate to mcrypt_encrypt in PHP 7.2

Display Link Title Instead of URL in XSL

About Contact Privacy policy Terms and conditions