config/providers.pyfile, you will find a
PROVIDERSlist which contains all the Service Providers involved in building the framework.
app/providers/DashboardProvider.py. This new Service Provider will have two simple methods, a
registermethod and a
bootmethod. We'll explain both in detail.
Usermodel into the container. There are three key features we have to go into detail here.
wsgi = Falsejust tells Masonite that this specific provider does not need the WSGI server to be running. When the WSGI server first starts, it will execute all service providers that have
False. Whenever a provider only binds things into the container and we don't need things like requests or routes, then consider setting
ServiceProviderclass we inherited from sets
Trueby default. Whenever
Truethen the service provider will fire the boot method on every request.
registermethod, it's important that we only bind things into the container. When the server is booted, Masonite will execute all register methods on all service providers. This is so the
bootmethod will have access to the entire container.
bootmethod is resolved by the container.