Often i come find it problematic when deciding where to place folders to resources within the app\
folder.
Where should i place things such as model observers
and validators
and form macros
and repositories
.... currently i do the following
\app
\models
\controllers
\repositories
\observers
\interfaces
\validators
\views
although i see some people do the following:
\app
\models
\controllers
\views
\YourAppNameHere
\Services
\validators
\...
I do not understand the reason behind the \Acme folder when its the same as the actual application?
Best way to master Laravel folder structure is to treat app directory as a front end of framework. If you take a look at the git repository you'll see that they are separated - you can clone core library and you can clone laravel application alone. Application, with it's subfolders represents just one way in which framework can be used. Ofcourse, it is designed with best practices involved. Check out also core framework tests directory - there Laravel developers treated library as "headless" - without application. For me, it was everything I need to grasp Laravel.
So you are free to modify existing structure, but keep in mind that some changes require you to composer dump-autoload - mostly because of namespaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With