What would the Laravel 5 directory structure look like for serving multiple sites and APIs?

570 Views Asked by At

Say I have multiple "sites" (ie. backend, public frontend, private-pay-for frontend, mobile) and perhaps also would like to offer an API for some widget services or Android app. The sites will need to (at least initially) share the same Laravel instance and will be sharing some services (ie. the frontend site might call a few services from the backend site, or the backend site and an API might share some services, especially since I'm using good SoC from things like presentation logic).

Looking at Userscape's project Snappy, Taylor Otwell says they renamed the models folder to be called snappy and just added more folders for various "areas of responsibility". This was in Laravel 4 however.

Here's the Laravel 5 directory default directory structure:

app     <-- Should I rename and duplicate for backend, frontend, api...?
   Commands
   Console
   Events
   Exceptions
   Handlers
   Http
      Controllers  <-- Or add subfolders in Controllers for backend, frontend, api...?
      Middleware
      Requests
   Providers
   Services       <-- And add subfolders in Services for backend, frontend, api...?
bootstrap
config
database
public
resources
storage
tests
vendor

How should we approach the directory structure in Laravel 5 for such situations (keeping in mind concerns of namespacing)? I didn't catch any guidance on this from the docs.

0

There are 0 best solutions below