I am about to start developing a web application using Ember.js as front end technology and Codeigniter at backend.
The issue on which I am struck is how to embed or use ember js with codeigniter. There is a possibility of exposing JSON objects from codeigniter through webservices and use them from ember. But in this case there can be an issue of handling sessions and cookies. I don't know whether it is possible to embed ember into codeigniter and accessing data directly with some technique. I am also searching through net but not getting any exact response.
What exactly technique should be used to embed ember js into codeigniter.
Thanks.
Basically, it's the same thing as using any other framework with Ember.js, sorta. The problem is that Codeigniter doesn't have any built in ORM or good PDO drivers. Since it hasn't changed for years and it's still using an older version of PHP, you might have a hard time. There have been some improvements in the PHP library section with the help of Composer (though , it's insanely slow). You can leverage some of the more popular ORMs like Laravel's Eloquent.
A few searches brings this tutorial up: http://mannyisles.com/using-eloquent-orm-inside-codeigniter.html
This will allow you to easily expose JSON objects that come from the database with a nice API. The next thing would be to use Ember Data. By default, Ember Data uses a RESTful API. This is what you need. You would build controllers and models that follow the RESTful convention.
That's basically it. Sessions are all worked out on the server-side. But you can check out these posts explaining things about user authentication:
Best way to enforce user/authentication state in Ember.JS app
Handling user authentication when using ember.js
There isn't much difference between framework integrating with Ember, but codeigniter is one exception. I would suggest using a more modern solution like Laravel 4 which will make it extremely easier to expose a JSON API. You'll have to do some workarounds with Codeigniter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With