Sunday 6 November 2011

CodeIgniter-RestServer customized for MongoDB

 Hi All,

I am a programmer, interested in web development ( I think this much of introduction is enough for now :) ).

I recently forked ( with the Author's permission) the CodeIgniter-RestServer's respository from https://github.com/philsturgeon/codeigniter-restserver for making some changes, and I will be soon submitting a pull request once I am done with all the changes.

My repository is at https://github.com/chakram321/codeigniter-restserver.

Basically restserver is a PHP framework for powering the REST API of your application, and it includes features such as authentication functionality for your application's REST server using keys and passwords, rate limiting in order to limit the API requests and logging features in order to maintain details of each request.

The original version by Phil Sturgeon uses MySQL DB in order to store the authentication keys, rate limits and logs.

I felt that it would be good if faster database like MongoDB www.mongodb.org/
 can do this better and faster and obviously it would enhance the restserver's performance massively since the performance improvement will be for each request's authentication, logging and rate limiting. 

This would help applications which require fast performance.

Hence I customized the restserver in order to use MongoDB in place of MySQL. This change is available at  https://github.com/chakram321/codeigniter-restserver and it is working correctly as I tested with one of the applications I worked on.

I will be submitting a pull request once I make some further enhancements related to the same feature.

You can start using the MongoDB migrated version from my location  ( this version does not include old code for using MySQL code but I will be including that in future before submitting pull request) until I submit the pull request.

You can have a look at http://blip.tv/nerdy-adventures-of-phil-sturgeon/set-up-a-rest-api-with-codeigniter-4917931 for inforation about the usage.

Please refer to application/controllers/api/example.php for one of the examples on how to use the restserver and just start of powering you web application with your own REST API's.

My final version would enable the user of the restserver to use both MySQL and MongoDB in his/her application ( since the comprehensive application usually needs both a SQL and NOSQL database).

I have used  https://github.com/kyledye/MongoDB-CodeIgniter-Driver which is a php driver for MongoDB. So, you may copy that from their although it's there in my respository.

So, I encourage all MongoDB-PHP coders as well as others to use restserver for their REST API's development.

I will highly appreciate your feedback. Feel free to ask any questions and to report any issues related to my changes.

Thank you very much.
Sincerely,
J.