In a typical Laravel application we are very used to doing things in a certain way, by the book as they say. However there comes a point in the applications lifetime that it is going to be easier to start looking to split this code into Domains so that we can logically group our code.

The next thing we want to make sure that we do is create a Service Provider for each domain.

An example of the Service Provider will look like this: [ // All others that come with Laravel /* * Domain Service Providers */ Domains\Communication\Providers\CommunicationServiceProvider::class, Domains\Blogging\Providers\BloggingServiceProvider::class, Domains\Work\Providers\WorkServiceProvider::class, ]]; This allows us, using configuration, to turn domains on and off simply by commenting our the service provider.

Now that we have our domains being loaded through composer, and our Laravel application is aware of the service providers for each domain - we are ready to write actual domain code.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners