• 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

codeigniter 4 running error first time with xampp

retrieve data from database using session

file_put_content...fail to open stream:Permission denied in Laravel 5

get attribute from class not working php 7

How to delete old images from public folder on update using Laravel

Handling expired token in Laravel

correct PHP headers for pdf file download

Laravel 8 Multiple Relationships for Factory

How do I do HTTP basic authentication using Guzzle?

Passing a boolean value from checkbox in Laravel form

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

Apply session id from request header

Select option menu read from database and use it's values

Composer fails with kylekatarnls/update-helper on new homestead

How Can I Do LIMIT 1, 2 In WP_Query

About Contact Privacy policy Terms and conditions