• 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

getting error while enter Command => php artisan route:list

How to Create WooCommerce Subscription Product via. REST API?

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

How do I loop through an MS SQL database with VB.NET?

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

Valet, Xdebug after reboot Big Sur not working

Send POST data via raw JSON with Postman

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

Laravel Factory not calling callback 'afterCreating'

Exception thrown during the rendering of a template("Parameter "id" for route "url" must match "[^/]++" ("" given) to generate a corresponding URL.")

Yii2 select2 database exception number of bound variables does not match number of tokens

Prestashop webservice API creating cart rules

Transpose multidimensional array and join values with commas

OctoberCMS / Anonymous Global Scope

ConstraintViolationListInterface to Exception in Symfony

About Contact Privacy policy Terms and conditions