Build and Deploy a Mobile-Friendly Calorie Counter on IBM Bluemix with PHP, MySQL, AngularJS and the Nutritionix API

The Nutritionix API is an online API which lets you access a massive database of nutrition information, covering both generic and branded food items. I came across it recently when looking for something else, and was promptly diverted from my original goal into trying it out.

While playing with it, it occurred to me that this could be the basis of a very neat little application to track calorie consumption. Ideally, it needed to work on a mobile device so that it would be at hand at meal-times, and be simple, interactive and easy to use. After a little thought, I had my requirements and design down, so I went ahead and built it.

Check out the video below to see it in action:

For the user interface, I used jQuery Mobile and AngularJS (something I’ve been itching to play with for a while). On the server, I used Slim, a PHP micro-framework, to connect with the Nutritionix API. The application is deployed on IBM Bluemix, which is also responsible for providing a MySQL service instance for account and meal record storage.

Although I’ve used the PHP/MySQL combination on IBM Bluemix before, this application gave me an opportunity to try something new: email send-outs. If you’re developing locally, or on a system you have administrative privileges for, it’s easy enough to configure a mail server to handle outgoing email traffic, then use PHP’s mail() function to do the deed. On a PaaS service, this isn’t quite as easy…but Bluemix’s SendGrid service provides a viable solution if you’re willing to experiment a bit.

For the full story, read my IBM developerWorks article…and then, don’t forget to try the demo app.

Build and Deploy a REST API on IBM Bluemix with PHP and MySQL

I’ve been experimenting with IBM Bluemix for some time now and a few weeks ago, I decided to try hosting a custom REST API with it. I built the API using Bullet, a PHP micro-framework, then deployed it to Bluemix and connected it with Bluemix’s MySQL service. It worked out pretty well…as you can see by trying this live demo.

In case you’re interested in learning how I went about building this, you can read all about it in this IBM developerWorks article. In this article, I explain how to implement the four basic REST methods using Bullet, then add support for API authentication and multiformat support, and finally deploy the API to Bluemix. Take a look, then download the API source and see what you think!