What's all this fuss with Laravel ?

Hey guys,

So these days i was doing some research for a small project i want to work and needed the ability to create a jsonapi.org compliant api in php(as a counterpart of a GO application).

Seems that at this point there’s nothing tailored to Yii (it is something i might add as an extension in the future though) but yeah, that’s not the actual point, thing is i found a laravel app that does all of the things i need, so i started to dive into laravel to see what’s the deal with this framework since i see lots of people jumping into using it and i am pretty open at using new things if they make things easier for me.

I browsed the source code and all for a few days, and of course did a lot of googling around the issue i faced, this was all just for fun, i didn’t really end up using laravel for the project at hand for some other reasons.

Anyway, while looking into the subject, i saw how praised laravel is and really i cannot find a reason why so many people swear by it, i mean, i literally could not find a thing that laravel does and yii does not, or even something that laravel does better, instead i know yii does so many more things, but this might be as well the result of using yii 1.x for few years and maybe i would have had same thoughts about laravel if i’d been using it for that long.

I don’t think i am biased towards yii as nowadays i really am using more GO than PHP, so can someone tell me what i am missing here?

It’s this all just an aggressive marketing result for laravel?

Please let’s not start bashing, just stick to the point exactly.

If laravel does some things that yii does not, or does some things better, can we make yii go there too ?

I personally don’t have much experience with laravel, but if anyone has and can share more would make things more clear.

Thanks.

When I look at Laravel I see many of the things that made Ruby on Rails a huge player: a whole lot of hot air. :)

No, I don’t know what Laravel has that Yii does not - or, rather: I would not like Yii to have that level of evangelism.

In my view, Laravel caters for the large group of people who wants to have instant gratification. And the way it does that is by means of Laracasts.

People do not want to read technical articles, they want to learn ‘to be artisans’ simply by watching screen casts.

Instant gratification.

EDIT:

And Laravel has Jeffrey Way who has years of experience in selling tutorials (Tuts+) and thus there is a strong economical interest in providing/promoting screen casts, etc. for money.

Truth be told: I am somewhat happy that Laravel gets all those users because that means that Yii gets less of users of that category.

Win-win. :P

I have toyed with the idea of using Laravel, but when I look at the Laravel website, there are exactly zero reasons for using it. What features does it have?

Nothing. Except ‘beautiful code’, ‘be an artisan’ and other wildly optimistic catch phrases.

I am not against that - Yii could use some of that boldness, but - as a seasoned programmer - I do not want to use something that makes me cool. I want to use something that has real, concrete features.

But, I will investigate - because if Laravel really does have some features that Yii should have, then Yii should have them ;)

This is a review of Yii from a Laravel dude:

:lol:

Laravel has better docs.

Yii is unfortunately split up between Yii 1 and Yii 2.

Yii has a lot of wiki articles and extensions that are mainly written for Yii 1. And while Yii 2 has the ‘ultimate guide’, it is not easy to find Yii 2 resources, like extensions and articles (wiki).

I think a much better wiki would be a huge leap forward for Yii because Yii is more community oriented than Laravel (AFAIK).

6915

google-trends.png

So this is what Google Trends tell us about the trends of PHP frameworks in this decade.

In May 2015, Laravel caught Yii, and Yii lost its up-going power. I wonder what happened then.

I think that what happened is that while Yii 1 has been replaced by Yii 2, not enough has been done to update wiki/extensions/website.

People - myself included - have taken too long to move from 1 to 2.

There are still a lot of outdated information floating around, and that makes it daunting to upgrade.

But I think what is the biggest problem is that Yii took a big leap with Yii 2, and people simply need to wake up and realize that the future is all about namespaces, Composer and modern PHP.

I am actually surprised that people are using Yii 1 to start new projects - why is that?

Is Yii suffering from the same thing that Python has suffered from a long time? (Python 2 versus Python 3).

I wonder what happens if Yii2 is included in that web trends graph?

Here it is.

Looks like it proves your observation.

6916

google-trends-2.png

It does look that way, yes.

I found a comparison that is surprisingly unbiased:

http://magora-system…yii-vs-laravel/

It does look like the two frameworks are pretty equal in terms of features.

Noticed that Yii2 has almost twice the amount of contributors than laravel.

There is no way Yii2 can best the amount of stars that laravel has, though. (And who cares anyway?)

As I wrote once in some post, I believe we need to have Yii 2 versions of “Blog Tutorial” and “Larry Ullman’s Learning Yii series”.

The success of Laravel is because many people migrate to CodeIgniter from Laravel and their market is stronger than Yii.

They have many other things that facilitate developers, a simple example is DI, in Laravel, you use DI to model from Controller easier than Yii, like native PHP.

Laravel works like a "middle way" to CodeIgniter. With CI we need create everything by hand, with laravel only the view, the "Artisan" creates the model and controller. Maybe it made CI users migrate to Laravel. They have a microframework and LTS version.

Other thing, many developers hates "magic code" or "code ready" like Yii generates. But these developers forget that, if want everything by hand, only do it.

One big problem that Yii also have is that people keep promoting Yii 1 in tutorials, blog posts, etc.

For instance, the latest FB post by Cloudways on our FB group page is about installing Yii 1… :(

I am almost thinking of banning all the users that posts Yii 1 specific stuff. :(

You are right. It seems like they are receiving users from CI and CakePHP, but also from Yii.

Yii could have that too. Maybe we should? Alternatively?

We need better docs to show people that it is easy to be in control of that. Either by doing it by hand, customizing code or even write our own templates/generators.

Indeed seems a good part of the CI community migrated to Laravel so that might have been a reason.

I migrated to Yii from CI too and at that point, compared with CI, Yii was huge, overwhelming, almost gave up few times, but i am glad i did not. I guess this is the feeling for new comers too ?

Related to the DI/Other magic, i think Laravel is type-hinting too much for class constructor and class methods and that makes it somehow slow(er).

I believe with Yii2 you can type-hint in class methods, i remember i read that somewhere, and if that’s true, then we would miss the __construct type-hinting which in yii case is not necessary given the way Yii resolves services and that it uses a singleton to access them. i might be wrong given my experience with Yii2 (almost nil)

One little thing that i liked, is that they have these little helpers like app() / user() / request() they use throughout the app. I think we can have something like this, i find it a great replacement to type




app()->params // instead of \Yii::$app->params;

// or

request()->post() // instead of  \Yii::$app->request->post();



Also i like the fact they use dotenv library for environment variables, it makes things so much easier when working in teams.

Guess it’s these little things that could also benefit yii.

@jacmoe, related to:

Probably Yii was too much for this guy i guess.

I personally have nothing against array configurations, i guess you get their value after a while. laravel has array configurations too.

Migrations in Yii works, they always did afaik. It’s true that the interface is not so fluid like laravel’s but it gets the job done with little effort.

This thing with path configuration is pretty much a lie, you don’t really have to do it, so i don’t see where his idea came from, maybe aliases?

Routes can be grouped in Yii2, so this is not a problem anymore, and i find the way Yii builds the urls very smart. In laravel urls parsing is(was?) a real problem degrading performance a lot.

Widgets are a hell of a necessity if you are reusing big parts of code in views and you need a bit more logic that can fit the view. I find widgets terrible helpful, same goes for modules, they do have their place.

Command tools… this is very subjective, but damn when Yii generates a model, it does it with full relations, comments, rules and so on. Laravel just generates an empty scheleton.

I have to agree with him related to the fact he implemented dotend, this is really a must…so maybe we can have this?

Anyway, i think there are a few things we can learn and implement from this discussion, seems to be very constructive :)

The learn curve of Yii is high (less then Yii 1), but still high. In my opinion the Yii Doc is poor, it doesn’t simple examples. Many thing linked to class reference (guide) that shows everething about the class. Why?

Developers don’t want know (at the moment) what Properties, Methods and what his visibility.

We want exaple how to configure (include WHERE) it. How to use it and WHERE. Not a piece of code came from anyware. The documentatios assumed that you know each "coma" of the framework.

To me it’s a worst thing is that framework.

I am sick and tired of ‘people’ complaining about bad documentation if ‘they’ are not actually actively working on improving it.

Hopefully, it will be easier to help out in the future when Yii gets a better wiki.

It was also very hard for me to overcome the initial learning curve when I first started to learn Yii 1.

I was from CI too. It took me about half a year to feel myself comfortable with the documentation system of Yii …

  • The guide that requires you to read thoroughly from top to bottom.

  • The API reference that requires you to be already familiar with the entire scheme of the framework.

Once you have overcome the initial climb, you’ll agree that this is the most efficient documentation. But, I remember it was not very easy for me.

What about Yii 2? I don’t think it’s easier than Yii 1, at least for the new comers. I’m very comfortable with Yii 2, but I think it is because I already have the basis that I gained from Yii 1.

Well, one thing we should note: Laravel 5 is very slow, hehe, although Yii 2 is not very fast.

PHP Framework Benchmark

PHP ORM Benchmark

dotenv PHP lib isn’t production thing and it was stated multiple times by its author. It proved to be not reliable in mpm environment. I’m not sure there’s a huge warning about not using dotenv at production and using real environment vars instead in Laravel docs but it should be there.