I've been using laravel for a few weeks now, and I have to say, I'm not getting used to the folder structure at all.
I find it a hindrance rather than a support.
The most common folders / files I use are:
- app/Http/Controllers/*
- app/Http/routes.php
- app/Helpers/*
- app/Models/*
- app/Services/*
- config/*
- database/migrations/*
- database/seeds/*
- packages/davestewart/*
- public/*
- resources/views/*
All of which are completely spread out all over the project:
root
+- app
| +- Commands
| +- Console
| +- Events
| +- Exceptions
| +- Handlers
| +- Helpers *
| +- Http
| +- Controllers *
| +- Middleware
| +- Requests
| +- routes.php *
| +- Models *
| +- Providers
| +- Services
+- bootstrap
+- config
+- database
| +- migrations *
| +- seeds *
+- packages *
| +- davestewart *
+- public *
+- resources
| +- assets *
| +- lang
| +- views *
+- storage
+- tests
+- vendor
This makes navigating and finding files a real pain, especially having views
so divorced from the app
folder (though I understand the reasoning) with a bunch of other "support"-style folders inbetween.
I've had a look through the source code, and it seems to be that Laravel will handle a restructure happily as it uses the main path helper functions throughout, the only issue being that some artisan commands and 3rd-party packages will break as they hard-code paths - but it looks like I can at least create the path helper functions myself, so most of the code artisan code will still work.
Ideally, I'd like to rearrange the app like this:
root
+- application
| +- app
| | +- core
| | | +- classes *
| | | +- controllers *
| | | +- middleware
| | | +- requests
| | | +- providers
| | | +- services *
| | +- data
| | | +- meta *
| | | +- models *
| | | +- repositories *
| | +- support
| | +- commands
| | +- console
| | +- events
| | +- exceptions
| | +- handlers
| +- resources
| | +- assets
| | +- config *
| | +- database *
| | +- lang
| | +- views *
| +- support
| +- bootstrap
| +- build
| | +- node_modules
| | +- bower_components
| +- storage
| +- tests
+- packages
| +- davestewart *
+- public *
+- vendor
This way, everything is properly siloed to my workflow, and I can just close folders I never look at.
Assuming I can provide alternate path helper functions, and that Composer will take care of autoloading via namespaces, is there any reason I can't do this?
If it does work, there's no reason I couldn't save this as a default project, or even write an artisan command to migrate new laravel projects for me.
I use non-standard structure as well. I've fixed all paths and have no probs at all.
I've changed a few folders, not as many as you've listed, and also had no problems.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community