Published 3 years ago by OpticNectar
I just wanted to see if i'm the only one that thinks Laravel 5 is a mess. Some quick thoughts:
App Structure Is Messy: App structure makes no sense now. Why are your view templates, which are app specific, outside of the app folder? Why don't models have a folder anymore (they are kind of important)?
Why are HTML and Form facades removed, yet auth is added in? I feel like HTML and Form facades are used way more then auth is or at the very least the same amount. I'm all for shrinking the code base, but not by taking things out that most people use.
Why are generators still awful? Way/Generators should be built in since anyone and everyone uses them. Look at how Rails does generators, that's how it should be done. I should be able to pass in table values and have the migration generated automatically with the fields I passed. Also, scaffolding should be an option since most people are going to use basic restful routes and views etc and if not, they can just not use scaffolding or delete them. Way/Generators doesn't work in 5 btw.
I think the app structure is actually much more concise now. Yes, the views are app-specific, but the views are not really part of the business logic of the app - which is what is in the app folder now - they're for presentation, which is now separated. Controllers, Commands, Events, etc. If you want the models directory, you can put it back - nothing stopping you there.
In terms of HTML and Forms, Taylor actually discussed this in the most recent podcast. Essentially, they were removed as he considered them to be far too opinionated to be part of the Laravel core. By removing them, he can focus more on things that are central to the framework. They're not included, but they're only a composer require away.
That all said, if you prefer the structure of Laravel 4.2 you can continue using 4.2. If you prefer the structure of 5, then you can use 5. Nobody's being forced to use either, though.
There's been a bit of discussion about the move, but it's been in the works for the better part of a year, the time to suggest alternatives is long since passed.
The app structure is just an example. You can use it if it makes sense for your project, or change it however you like if you need something different. Namespaces to the rescue!
Check these 2 blog posts:
Well as far as views not being a part of the business logic. Well since views are what the user sees and that is how they interact with the site. I'd would argue that is about 50% of the app, so taking 50% of the app out of the app folder makes no sense. And yeah I realize it's probably too late now. It just sucks, cause I wanted to keep using Laravel, but now and app that would take me a few hours, now takes double the time cause of all the extra BS I have to add and configure to get it working the way it should work from the get-go. It is also a lot harder for newcomers (I train people in laravel) to understand. I guess back to rails it is lol.
You don't really need to configure stuff with every new install.
At the end of the day, what's provided from a fresh install is just a suggestion.
You can literally do just about anything you want, and as @Ruffles suggests, if you want to change the app structure for all of your projects, you can do that easily enough as well.
A lot of good points. Maybe i'll reconfigure everything to make more sense such as the views folder as @usman suggested and just make it a template as @Ruffles suggested. Thanks for the help guys. I guess i'm just bitter because Rails has most of this built in, is structured better, and is easier to use, so I was hoping Laravel would get closer to it, not further away.
You dont need the Way/Generators in Laravel because the functions are already included. Just type php artisan to see all (new) commands.
Because your view folder: If you dont like the structure, make your own. In the view config you can change the path of your views folder.
Views aren't stored inside the
app directory not because they're not part of the application, because the app folder is specifically for PSR-4 autoloaded classes. Essentially, the root Laravel 5 directory is similar to the old
app directory of Laravel 4.
EDIT: Also, I think it's a good thing the
models directory went away, it promotes the old (and usually messy) MVC structure where you try and shoehorn everything into either a Model or Controller with no regard to how different classes should be grouped conceptually.
I'm fairly new to Laravel, I started a few weeks ago with Laravel 4 and to be honest, I also think that Laravel 5 is less clear than 4. 5 might be better suited for large/enterprise applications, but it also lost a bit of its lightweight feeling.
It now feels more like Zend or something big and not like a lightweight framework (although maybe Laravel never was nor intended to be).
The thing that strikes me as odd is the idea of putting Controllers etc. in "Http". Yes, I understand the reason behind it, but I probably will never write a non-HTTP application in PHP that uses Laravel. So this is just an unnecessary concept.
Before, it felt like the folder structure of Laravel 4 fits my application perfectly. Now it feels like there's so much room for some sort of "extendability" that I will never use anyways.
I guess, before Laravel was more "opinionated" and with more clarity to some of us, which was sacrificed for flexibility and extensibility. Can't judge yet if this was a good move or not.
@cm I don't think that it is because you won't write a non-HTTP controller, but it is because you most likely will write other entry points into your app. And because each entry point is contained within its own directory and named as such, for me at least, it makes sense to put Controllers within the HTTP directory.
Anyway, that is my thinking.
My ideas on the generators.
I have been thinking about this for the past fews day after working with L5.
Within php artisan you already have a majority of way-generators. The parts that are missing are what I miss most -- the RAD code that was laid out fro you by scaffolding. This saved me so much time! If you watch Laracast videos you notice that Jeffery has PHPStorm setup so that he can auto-generate lots of what his generators used to do.
I hope that the php artisan command is just gonna get better than what they are now. It would be awesome if the php artisan make commands evolve into the generators which essentially would be adding a scaffold ability and a way to use gists/templates to create the RAD stuff that a lot of us use.
Ideas about L5 It would be really nice to have a working demo app like all the starter kits for L4. Something simple, say a blog that encompasses the majority of the new design patterns that L5 uses. Having a reference app does probably go against what many people might think about learning php / laravel but not everybody learns the same way. Some love books, some love just digging in and learn by tinkering, some love videos, some love copying and what not. If the worry is that everybody will use that as a base to start then you might as enforce the same policy regarding using bootstrap within Larvel. L5 is really advanced and helping a large number of people to could only beneficial.
@ docs While this hasn't been brought up within this thread, I'd like to bring up the idea again that Jeffery applies his magic to them!
@ what happened For some reason, I feel that L5 was rushed out the door too soon. I had guessed that the release date should be Valentine's day and maybe 3 weeks would have been better. I do like how Laravel is moving forward rather than stabilizing staleness.