Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration
Last updated 2 years ago.
0

you can change bootstrap/start.php and set $env if php CLI is running (http://nl1.php.net/php_sapi_name)

Last updated 2 years ago.
0

I have looked at this but it impacts all cli commands, I was hoping for something like php artisan serve --env=testing. This may not be the best way of running integration tests

Last updated 2 years ago.
0

maybe you can set (define) the environment in /server.php and then check it in /bootstrap/start.php

Last updated 2 years ago.
0

Thanks, this worked. It took a few hacks to set everything up before the tests but at least its workable.

Last updated 2 years ago.
0

I figured it out. Use environment variables.

(in bash)

export APP_ENV=testing

(in bootstrap/start.php)

$env = $app->detectEnvironment(function ()
{
	return getenv('APP_ENV') ?: 'development';
});

If you do the export command before running the artisan server you'll be fine. Do

unset APP_ENV

afterwards to clear it.

Last updated 2 years ago.
0

So this way you have to manually change the environments?

Last updated 2 years ago.
0

I tried:

APP_ENV=local php artisan serve

And it seems to be working.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ArthurGuy arthurguy Joined 3 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.