Modules - General Information
Best Practice
When adding an Enso module to your app, it is best practice to create a new Service Provider and register it in config/app.php.
Within this, you should register any app-specific content and overrides to the module, or apply any alterations to the MenuItem specific to it.
Feature Toggles
If you implement a module or feature which may impede development if always on/off you can and should hide it behind a feature toggle. Using Mailer as an example, this could involve:
- Create a config property, e.g.
enso.features.mailer.enabled. - Allow overriding this value in the
.envfile and give it a sensible default. E.g.enabled => env('ENSO_MAILER_ENABLED', false),. - If any content requires your feature to be enabled, wrap it in a conditional. E.g.:
if (config('enso.features.mailer.enabled')) {
// Do things that require the mailer here
}