Yii 2.0 Beta And Laravel 4.x

I know this has been asked so much but right now I’m on the stage on which path (framework) to take.

After checking the documentations, features and tutorials of the many PHP frameworks around my top 2 contenders were Laravel and Yii.

For those who were able to explore both extensively I hope you can enlighten me further about the pros and cons of both sides and what can Yii 2.0 do that Laravel 4.x can’t and vice versa. Also if are there any crucial risk existing right now like security issues and/or slowness that exists on either of the framework.

Hope someone can help me and thanks in advance.

Yeah, like you’ve never heard about recent laravel security fuckup.

Anyway, check this link: http://www.yiiframework.com/forum/index.php/topic/48523-how-does-the-yii-deal-with-the-challenges-from-laravel/page__p__226613__hl__laravel__fromsearch__1#entry226613

If you come to a Yii 2 forum with that question, you are going to get predictable results. The best way to wrap your head around this question is to try working with both frameworks and see how it goes. There are other more qualified people in this forum who can give their opinion, but that doesn’t mean I’m not going to chime in

On the positive side for Laravel, they have some intuitive syntax for beginners, which people like and is one of the reasons why it’s popular. It’s not enough to make a mature framework though. Yii 2 has been years in the making by seasoned programmers and it shows.

[size=“2”]Yii 2 crushes Laravel in my opinion. It was part of my job as part of a team to determine the best framework and we went with Yii 1.14, which what was available at the time. Yii 2 is cleaner and easier to understand than previous versions and takes advantage of composer, the new array syntax, and namespaces. It’s awesome. I will leave it the others to list the bullet points for you on the new features and why they are so great. [/size]

Laravel is built upon Symfony 2 and uses Doctrine, a 3rd party ORM which makes it a bit of a Frankenstein. Also, things like form validation are more complicated with Laravel and they don’t have the ready-made widgets like Yii does, which are powerful and easy to use. The advanced template from Yii 2 gives you a working user login, forgot password, and frontend and backend separation. You get that right out of the box, a great starting point that will help you build site structure more much quickly and efficiently, just my experience.

Also, and I could be wrong about this, but with Laravel, you take a piecemeal approach to building data structure via migrations. There is no way to start with a data structure and generate code from that, whereas in Yii 2, you get Gii, a powerful code generation tool, which uses the database to create models, controllers, views, etc. This might be a matter of style preference in coding, but personally I think it is a much more powerful approach, especially when you get into projects that could have hundreds of tables. Do you really want each coder making up the data structure as they go along? Anyway, that’s just something I’m passionate about, I think data structure creation should be a centralized task.

Also, because Laravel is built on another framework, you have a lot of overhead/code bloat. I saw one comparison that put it at 2 1/2 times slower than Yii. Not good. You inevitably will get a performance trade off by using a framework, so you can’t avoid that entirely, but it’s best to keep it at a minimum if you can.

Yii 2 is not in general release yet, so you don’t have as much documentation available, so if you need to do a project quickly, that might slow you down. I can tell you from personal experience, the Yii community is very responsive and willing to answer even beginner questions.

It’s my own view that Yii 2 will become the dominant PHP framework once it’s in general release. My company will certainly be using it for enterprise development.

Well posted this on the Laravel forums as well but hasn’t got any replies yet.

Lol this is exactly what I was talking about here