Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should (or could) this just be a development dependency? #68

Open
judgej opened this issue Apr 10, 2019 · 2 comments
Open

Should (or could) this just be a development dependency? #68

judgej opened this issue Apr 10, 2019 · 2 comments

Comments

@judgej
Copy link

judgej commented Apr 10, 2019

Since we should not be generating anything on production, can this package be installed as a dev only dependency?

composer require --dev wn/lumen-generators

I'm asking in case there is any production run-time component of this package that is needed by generated components that I am not aware of.

If it can, then the documentation should probably mention this, since having it in production, I assume, will provide some extra load each request.

@judgej
Copy link
Author

judgej commented Apr 10, 2019

At a minimum, the App\Providers\AppServiceProvider needs to be aware that the package may not be installed.

...
use Wn\Generators\CommandsServiceProvider;
...

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        // Install the generators.

        if ($this->app->environment() === 'local' && class_exists(CommandsServiceProvider::class)) {
            $this->app->register(CommandsServiceProvider::class);
        }
    }
   ...
}

@judgej
Copy link
Author

judgej commented May 1, 2019

Even simpler in bootstrap/app.php:

if (class_exists(Wn\Generators\CommandsServiceProvider::class)) {
    $app->register(Wn\Generators\CommandsServiceProvider::class);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant