Environment Details
Get Laravel project environment on terminal:
$ php artisan env
Get Laravel project environment by code:
if (App::environment('local')) {
// The environment is local
}
if (App::environment(['local', 'staging'])) {
// The environment is either local OR staging...
}
Types of Laravel environments:
- local
- production
- staging
- testing <-- automatically sets when doing phpunit testing
Change environment:
Set the following on .env file:
APP_ENV=local
After changing .env file on production environment server, run following to apply the changes:
$ php artisan config:clear
Comments
Post a Comment