• 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

PHPExcel How to set conditional formatting to change cell background color based on cells values

How to Make Laravel Eloquent "IN" Query?

Failing validation doesn't stop code execution in livewire component

PHP Slim Framework request using withAttribute error

Laravel Excel::store file empty after stored

How to set a domain name with php artisan serve

Laravel display validation error

Handle error for duplicate entries - PHP/MySQL

MISSING UPDATES FOR: MEDIA Drupal 9

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

How to get the total hour from starting time to end time in php

Symfony run hint kernel.secret parameter not found

How to reset Laravel AuthManager/guards in between API calls in tests?

laravel automatically deletes server.php on php artisan serve

Access relation of pivot table in Laravel

About Contact Privacy policy Terms and conditions