mathiasgrimm / laravel-env-validator

Laravel Env Validator
80 stars 4 forks source link

Is Lumen supported? #6

Closed jfoliveira closed 8 years ago

jfoliveira commented 8 years ago

Hi, thanks for publishing this very useful package!

I know the package name says Laravel but as Laravel and Lumen are often used together I'm curious:

is this package supposed to work with Lumen?

Tried it on a Lumen project and this exception is raised:

Fatal error: Call to undefined function MathiasGrimm\LaravelEnvValidator\config_path() in 
/vendor/mathiasgrimm/laravel-env-validator/src/ServiceProvider.php on line 16

It seems many other packages had the same issue in the past

If Lumen is not aimed to be supported please let us know.

Thanks!

mathiasgrimm commented 8 years ago

I haven't tested it with Lumen. The idea is that it should be supported, however, will run some tests and see how it goes.

Thanks for raising the issue

jfoliveira commented 8 years ago

One change you might want to make is on src/EnvValidatorFactory.php:

public static function buildFromLaravelConfig()
{
    // $config    = \Config::get('laravel-env-validator'); # doesn't work with Lumen
    $config    = config('laravel-env-validator'); # <<< this works with Lumen. Not sure if it works with Laravel

Also, I would suggest creating a separate LumenServiceProvider to make it easier for you to maintain the package having the providers completely independent.

mathiasgrimm commented 8 years ago

Good idea.

On 22 February 2016 at 12:25, jfoliveira notifications@github.com wrote:

One change you might you want to make is src/EnvValidatorFactory.php

public static function buildFromLaravelConfig(){ // $config = \Config::get('laravel-env-validator'); # doesn't work with Lumen $config = config('laravel-env-validator'); # <<< this works with Lumen. Not sure if it works with Laravel

Also, I would suggest creating a separate LumenServiceProvider to make it easier for you to maintain the package having the providers completely independent.

— Reply to this email directly or view it on GitHub https://github.com/mathiasgrimm/laravel-env-validator/issues/6#issuecomment-187151591 .

jfoliveira commented 8 years ago

In case you need references, I would suggest: laravel-cors: https://github.com/barryvdh/laravel-cors/blob/master/src/LumenServiceProvider.php

jwt-auth: https://github.com/tymondesigns/jwt-auth/blob/develop/src/Providers/LumenServiceProvider.php

mathiasgrimm commented 8 years ago

Nice, will have a look on them!

Would you like to test yourself and submit a PR maybe? :)

On 22 February 2016 at 12:31, jfoliveira notifications@github.com wrote:

In case you need references, I would suggest: laravel-cors:

https://github.com/barryvdh/laravel-cors/blob/master/src/LumenServiceProvider.php

jwt-auth:

https://github.com/tymondesigns/jwt-auth/blob/develop/src/Providers/LumenServiceProvider.php

— Reply to this email directly or view it on GitHub https://github.com/mathiasgrimm/laravel-env-validator/issues/6#issuecomment-187152892 .

jfoliveira commented 8 years ago

Ok, will do. Would you mind creating a develop branch to make it easier to use git flow?

jfoliveira commented 8 years ago

Please ignore my last comment about creating develop branch. I set up git flow on my fork and it's fine. Thanks!

jfoliveira commented 8 years ago

Done #7

ghost commented 8 years ago

+1 for Lumen support. I've just downloaded and it's not working with Lumen. :-( Is this package ready for using with Lumen now?

mathiasgrimm commented 8 years ago

Done!