What's all this fuss with Laravel ?

btw. Thinking about how to improve. While irc is nice it could be also helpful to setup a slack channel or something :) modern framework should have modern tools for the community ;)

Such as https://gitter.im/yiisoft/yii2 ?

hmm yea very close :P thanks

Community->livechat still links to irc tho, not sure if it’s connected.

Well, IRC is still a thing. Many people don’t want to rely on closed source services.

As a new comer to yii2, I read a lot of comments in the internet about yii vs laravel and a lot of them were childish and non professional, so I didn’t pay too much attention to them.

still I found this guy who claim to have written a book on yii and went later to laravel he explains his choice in his blog:

https://yii2framework.wordpress.com/tag/yii-2-0-vs-laravel/

an open minded view on this might help the community.

comments on about what he said are appreciated.

Thank you for your post, DrokTor.

Reading the blog, I found the following part most interesting.

I feel that Yii’s Model might be too generic, at least for enterprise scale projects, although I myself do love the simplicity of it.

Does somebody have a real-world example of the Laravel model approach that showcases the difference to Yii?

You’re welcome.

I have to totally agree with this.

Previously i used Drupal a lot. There you also find a lot of video’s and tutorials. But just plain, short, documentation with good examples is hard to find. The Yii2 docs are very clear and complete (i am pretty new so we will see in the future ;) ). The only issue i have sometimes is that, when i search of the docs (with for example google) i end up at the class docs instead of the guide.

One thing that would be a huge improvement for me would be a better central system for extension, this is where Drupal really shines (bit OT but ok). A lot of the extensions on this website are created ones and never updated. So in the real life world i just search on google for an extension and find one on github.

The result is that there are multiple extensions for the same functionality (even forks published on packagist with one line of code changed).

Integration with github (to get a nice overview of the amount of contributors or stars for projects) would be a good option.

Laravel codes routes manually, which for me is a step backwards, because PHP is all about rapid prototyping and productive web development but according to laravel users manual routes are more secure and more powerful. Is this true?

I recalled in some blogs, some people also misunderstood what Yii widgets are - it discouraged them from using Yii.

It depends. More secure — yes if you’re leaving some sensitive controller code w/o access checks which normally should never happen. More powerful — yes. You can do more manually specifying all the routes. Yii supports that as well.

Have been using Yii and Yii2 for 5 years. Now I got my next office project, Team Leader decided using laravel as framework, because he never used Yii before.

I think The main cons in Yii is learning curve. I don’t know why, but I feel Laravel more easy to learn. But with many manual override in auth, route etc, I don’t think it can give me fastest solution. I never found any feature laravel can that Yii can not, but found many feature that Yii have in default that laravel don’t. If I were team leader, I would go back to Yii2.

Probably it’s time to change the team leader! :wink:

I just try Laravel 5.3 for one of my project, but a lot of think that me comfort with Yii2 not available by default in Laravel. So far I think Laravel just good and easy for newbie.

Yii2 have more great feature.

So now in 2017 this topic is still of actuality.

I evaluated many framework in different languages and sliced down the choice to Laravel 5.4 vs latest Yii. I never thought I’d been choosing the php stack, but this is another topic.

Anyway, when I try a new framework seriously I build an authentication system with it. I know it can be scaffolded or there is an extension in both project but for me it’s the best way to get a feel of the framework because it involves almost everything: routing, database, authentication / security, email, sessions…

I still didn’t made my choice because it is very difficult to chose.

yii pros:

  • Documentation: I was reading people complaining about documentation. Things must have changed because yii documentation is a killer. BETTER then laravel.

A concrete exemple: compare both getting started guides. In yii you end up with a running application and you have understood most of the principles. EVERYTHING is perectly detailed. In laravel they don’t clearly explain that you must do a ‘migration’. If you don’t know what it is, are you supposed to guess ?

  • Code documentation: the code documentation of yii is a dream.

  • Better recognition by my ide: php storm reports no error and all yii code is understood. In laravel even with their plugin and generator, code is still full of warnings.

  • yii has page and fragment cache. Laravel doesn’t and only has query caching. (i’m a perfomance freak).

  • Adherence to MVC structure. Some might not like this but I like to have real models.

  • Can create module of self contained apps (except the routes and mails that are still out).

  • Built in debug bar (i know you have it in laravel, but again you must rely on third party add on)

  • I don’t consider myself a very experienced programmer, still, I found learning curve of basic yii easy.

  • Has "macro" framework built on it, such as the excellent Craft cms

Laravel pros:

  • The framework is more broad: it incorporate feature such as event broadcasting, background queues. You really feel that the framework will let you grow with it and absorb the modernization of the php landscape faster than yii.

  • The orm supports polymorphic relations out of the box.

  • Altough less structured than traditional MVC, it seems a bit easier to get things done. So even easier learning curve.

  • Enormous community: you can get answers in seconds on stackoverflow or laracast forum when you have a problem.

  • has micro framework subset LUMEN which you can use to serve your rest API, sharing same db as full stack framework.

Yii seems more wise, professional, Laravel more dynamic.

It’s a very difficult choice to make. What i’m sure is that they are both excellent products.

Laravel is more opinionated than Yii.

That is why I am using Yii instead of Laravel.

In the end, they are so close to each other featurewise that it ultimately boils down to one question: do you like one over the other?

@brakkar

Thank you for a good report. It looks quite fair to me.

As a long-time Yii lover, I couldn’t agree more on the pros of Yii. You started the list with a praise to the documentation, yeah, that’s what made me convinced that your report is trustworthy.

And although I don’t have much experience in Laravel, I think I have to admit the pros of it that you’ve reported.

I think as a newbie, I may provide a different perspective.

My core area had always been WordPress and WooCommerce. I was happy doing custom plugin development and customisation for WooCommerce for my clients. I would never need a framework for that, and do all the coding in notepad++.

My search for a framework started when a client asked me to develop an invoicing and accounting app for him, with some very peculiar requirements. Since, core requirements here were going to be bootstrap based UI for a relational database, with nothing but some business rules coming into the play between normal CRUD; I decided it is a good case for using a framework instead of hand coding everything, so as to gain time advantage.

However, the issue was that I had never used any PHP framework, not even Code Igniter. So, I started evaluating the frameworks based on ease of creating a single table CRUD with user authentication. After some googling, I shortlisted CI, CakePHP, Symphony and Laravel. No Yii here, as you won’t see Yii being talked about much when you read opinion on PHP frameworks, as a newbie.

Anyway, among the frameworks I tested, I liked the ease of development that Cake3 offered, specially with its ‘bake’ feature. The convention also allowed for setting relationships between tables just by following naming conventions. It all looked good. However, the cookbook is one hell of a boring read. Every time I tried to build something bigger than the initial test application, I found myself taking a nap in the middle of reading the cake php guide. Also, using bootstrap requires plugins, which again have a very specific conventions regarding how your views should be coded. After losing considerable time (about 2 weeks), I realised that CakePHP is a no-go for me.

I resumed the search, but this time making Symphony as the benchmark, i.e., if I find nothing better then I’ll make the app in Symphony. The google search results again pushed me towards Laravel. I tried it and after maxing out my daily internet quota for 2 successive days, I had trouble in getting started towards building something useful. I don’t understand the praise for Laravel documentation. What it lacks is a high level overview, which tells you the full process and features, before going into the details.

There was another name which was thrown up by the search this time, probably due to inclusion of Symphony in the search - Yii. I didn’t have much time to waste now. Client was asking me to show him something for nearly 3 weeks I’ve already spent. Still, I reserved a day for Yii to give it a fair chance. I must say, the definitive guide is one of the best thing about Yii. It structures the content exactly the way a newbie is going to need them. Out of the box bootstrap integration was another thing, which made me like Yii. Finally when I started with basic app template, and used Gii, that basically sealed it for me. Yii it is going to be.

I was also fortunate enough to have discovered dektrium’s yii2-user plugin, and Karthik-v’s widgets early on. With the enhanced gii, I could actually focus on building the business logic, while base model, controller and view would be auto generated without requiring much customisation.

I would just like to say thanks to the creators of Yii and the aforementioned plugins, for making life so much easier for a newbie like me.

Why not. I’ll toss in my two cents about my experience and why I use Yii.

So, I manage a site that I took over a couple of years ago. At the time I was new to PHP, but I had a pretty good grasp of programming. The site desperately needed an overhaul from the front end to the back end. I noticed the back end had no framework behind it.

I had remembered a friend talking about CodeIgniter years prior. After talking to a friend I learned of the MVC pattern and searched for it. The first thing I found was CodeIgniter. So, without a second guess I hopped on the CI framework bandwagon. Which luckily for me was right after CI was acquired by the British Columbia Institute of Technology and they had just released CI3. This was great because I was also reading how CI was dead from a lack of updates and it had just been acquired so it would be receiving further support.

The needs of the site outgrew how basic CI. Because Composer documentation in CI is very slim we weren’t using Composer; subsequently I was new to Composer when I started using Yii. We started adding and loading additional libraries manually to the CI project. This was a pain as most recommended using Composer and not all libraries had documentation for being loaded manually. While some libraries, from what I found, couldn’t be loaded manually without jumping through so many hoops, making it impractical to use.

CodeIgniter also isn’t a very well structured framework when it comes to where to place the business logic. This lead to all of our controllers handling form validation, file uploads, everything really. The only thing the models provided was access to the database, and by that I mean simple CRUD. It didn’t check that the data being inserted was valid, again that was all in the controller. As you can imagine this caused a lot of controller bloat and made the project very inflexible.

Fast forward to present after a long time developing. I decided it was time to switch frameworks. I was asked what does Yii2 fix/solve/provide that CI doesn’t or that couldn’t be added. I couldn’t articulate it very well, but I had read some articles about Yii2 vs CI3. So, I knew a little about the differences and I liked what I read about Yii2; it was this comparison I found http://vschart.com/compare/yii/vs/codeigniter - some of the comparisons are nonsense BS, but others are really useful.

I also looked at other frameworks around this time to see if they might be better. The answer I fairly quickly found was no. I didn’t really try the other frameworks. I looked at the documentation. As a friend of mine says most people don’t document as they go and don’t like to go back and document. This is very true. The closest contender was Laravel in terms of much of what I was looking for. However, it’s documentation left much to be desired. I read through a lot of Yii2’s documentation and liked how it has well defined structure for an MVC framework.

The extensiveness of the documentation is by far the biggest attraction for me. Recently I found out that a friend wasn’t using a framework for a project she manages. I promptly recommended her to use Yii2, showed her the documentation and I also showed her the the code generator, she was immediately impressed, liked it, and wants to implement it in her project.

In comparison to CodeIgniter, Yii has a steeper learning curve. While the documentation is a huge plus I can see it also being a bit of a detractor. Though, I feel these are people who don’t want to read documentation anyway, they just want it to magically work with as little effort as possible.

However, the detractor for me is how tightly integrated the framework is and plugins are with Bootstrap. I use Foundation for my front end framework because it’s a professional and more mature framework than Bootstrap. The only Foundation plugin for Yii I could find hasn’t been updated in a long time and didn’t provide the Sass or other source files for full customization. While I understand Bootstrap provides a base entry for styles, I don’t feel Yii should be so tightly coupled with it. I think an abstraction layer for implementing front end frameworks would be quite beneficial.

tl;dr

Moved from CI. The documentation is the biggest hook for me when compared with Laravel since both provide much of the same functionality - at least from the comparisons I’ve looked at. The one caveat for me is that it really only supports Bootstrap out of the box for front end.

2c.

  1. Yii2 vs laravel - Yii2 on documentation

I use Eloquent and Yii2, which is Lavavels ORM for database access. It’s neat and tidy. But the documentation is poor.

Why not just have a page where it shows all the methods? How about searching for it and the APIs. Yii2 is much clearer although you cannot pull out the ORM and just use it.

  1. Gii

Gii saves me all the trouble, creating MVC on the fly which cuts development time with the CRUD. Wiring it up takes a bit of being used to, but isn’t that what a framework is about.

  1. Yii2 is just a little cleaner and sharper.

  2. Could you guys look at bringing in Yii2 with Vue.js?