General Discussion

Paul Bentham
Paul Bentham
22,453 Points

Why would you use Ember JS & Laravel together rather than one or the other?

So I'm trying to understand the benefits of using both, would using one not suffice? Under what circumstances would using both be necessary?

I don't know whether to bother learning both, I think it will get confusing using 2 MVC frameworks.

Can someone let me know as I'm genuinely interested, if it is worthwhile perhaps we could have a course on using the two together.

Thanks,

Paul

4 Answers

Nikolay Batrakov
Nikolay Batrakov
9,604 Points

Laravel, as I might understand, is a back end framework, Ember on the contrary, is a front end MVC. Benefits of using both are pretty much the same but the point of the application is different.

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Paul;

Using the two together is not uncommon, I see more probably using Ember.js for front end and Ruby on Rails for back end, but the thought process is the same.

Ember.js for front end and Laravel for backend simplifies some of the tasks associated with both that can be time consuming. You can have one route in Laravel that directs to Ember which then handles the routes. Not that routing is difficult in Laravel, but I find it slightly easier in Ember. From a database management standpoint, Laravel/Rails wins for me in terms of ease of use in accessing data over Ember and JavaScript/JQuery attempting to get at a data store. I am sure others will argue differently, but that is my experience.

There is a bit of a learning curve to get Ember and Laravel to live together peacefully, but it isn't too bad.

Just my thoughts,

Ken

Paul Bentham
Paul Bentham
22,453 Points

I understand one is front end and one is back end - what difference does this make though? Is it better / faster to work back end?

In terms of where I'm best spending my time learning would you recommend one over the other? I have more experience with Laravel & PHP generally.

It would be good to get some examples of where one framework may work better under the circumstances etc...

Nikolay Batrakov
Nikolay Batrakov
9,604 Points

An example

Say you have some items, you need to output to the browser, a list of names for instance. You do it from the database in loop. Say you want to change a name to an input form on click. If you just set up a listener on click, it obviously changes all elements in the list, while you need only one input form - the one you click on. You can imagine what you ought to do in plain JS to implement this. In Ember you only need to create a view

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Paul;

My background has been in PHP/MySQL so I have found Laravel to be fairly straight forward while moving into Ember has involved a much steeper learning curve. Your mileage may vary.

Ken