• 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 can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

Laravel passport auth token not working after moving to different server

laravel automatically deletes server.php on php artisan serve

Log file is not being written in Laravel 5.5

Correctly determine if date string is a valid date in that format

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

PDOException SQLSTATE[HY000] [2002] No such file or directory

Laravel phpunit test failing authorization

Cannot connect to own websocket server when on secured domain

ldap is missing from system when installing adldap2 in laravel

Laravel unique validation on multiple columns

How do I remove this delivery notification from here?

About Contact Privacy policy Terms and conditions