Using/embedding Ember Js With/in Codeigniter
Solution 1:
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:
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.
Solution 2:
Create a RESTful CodeIgniter installation... you can find a tutorial here: RESTful CodeIgniter tutorial
Also, you CAN use PDO with CodeIgniter: Codeigniter with PDO
Solution 3:
Idiorm also works really well for PDO with CodeIgniter. See,e.g., http://sfthurber.github.io/cim-xa/
Post a Comment for "Using/embedding Ember Js With/in Codeigniter"