• 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

Laravel after login Two factor not working

301 Redirect to remove query string on homepage only

How to render html from a @foreach loop in a textarea

Transpose multidimensional array and join values with commas

PHP each() function replacement

Assign output of PHP function to a variable

How to keep value of selected value after form submission?

Custom post type single page not working

How to make dot match newline characters using regular expressions

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

Laravel You requested 1 items, but there are only 0 items available

How to create a cookie to store the timestamp of when a page is first loaded with php

Laravel lang slug in url

is there any way to validate a field that sometime is File(image) && sometime is String(Src of same image)

Cut an arabic string

About Contact Privacy policy Terms and conditions