• 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 send parameters in soap request in php in __soapcall() function

Trying to mock an http client that is inside a controller, using phpunit, but it doesn't work

Submitting a form with ajax in Wordpress

JQuery content editable div and text box on submit not sending POST

Attempt to read property "view" on null when sending password reset email

Display the WooCommerce product price inside a custom function

insert multiple rows in a saveall in cakephp

Laravel display validation error

Laravel: Why is my variable not being set while it's in the construct function of the controller?

How to add a custom field to all Woocommerce attribute terms using add_action

How to override header set in Apache config with more specific header in a virtual host

How can I get a div content in php

PHPExcel file download using AJAX call

api response laravel doesn't show

Edit XML in HTML form and submit to self

About Contact Privacy policy Terms and conditions