• 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

PHP - Store information with NO database

Laravel UUID generation

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

How can I make good efficent AJAX live forms with just jQuery and

ldap is missing from system when installing adldap2 in laravel

Exact alternate to mcrypt_encrypt in PHP 7.2

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

Laravel Model save() & update() Not Saving

hidden INPUT value not available in $_POST

PHP Fatal error: Class not found - PHPUnit

Elastic Beanstalk with Laravel Envoy

Submitting a form with ajax in Wordpress

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Check if my GET request has Header: Token

Creating live search with AJAX and CodeIgniter

About Contact Privacy policy Terms and conditions