Last week I shared that I was working on a Symfony 2 bundle that would create REST end points from Doctrine entities. I've been continuing to work on that bundle, adding features and flexibility and I decided to re-evaluate the way I was demoing it. The truth is that I didn't want to sink a lot of time into writing a demo, but I also want to do a show more functionality than just pulling down some objects from and dumping them to a page. What I want is to show the full REST life cycle, getting, searching and saving objects to an api. Fortunately there's a really great tool out there that plugs into a REST api and does just that! It’s called ng-admin and it’s from the folks over at Marmelab.
For those that aren't familiar with ng-admin, it's a tool written using Angular and it allows you to easily wire up a "stock" UI for a REST API. Like my own project, it's opinionated and convention oriented. Quite honestly it's a pretty cool tool. So I’ve hooked it up to a symfony standard application with the LemonRestBundle and configured some entities to match Marmelab’s own demo. I also pulled the sample data down that Marmelab was using and stuck it in a sqlite database. The database resets every minute, but it’s enough time to create a post and edit some comments and see LemonRestBundle in action. The really cool part is when you take a look at the demo app’s GitHub repository and realize it took three Entity classes to make the whole thing happen.
I’ve deployed the demo over at OpenShift so you can take a look and try it out for yourself. You can also clone the demo app from GitHub, run composer.phar install and try it yourself!
Links to check out:
- LemonRestBundle for Symfony
- Demo app repository for LemonRestBundle
- Live demo of LemonRestBundle on OpenShift
- ng-admin by Marmelab