Build a Notepad Application with PHP, MongoDB, and IBM Bluemix

I’ve been looking for an excuse to play with MongoLab’s DBaaS for a while…so when I had to choose a database for my latest IBM Bluemix application, MongoDB was first on my list. I like the idea of a document-oriented database as an alternative to the traditional RDBMS, and I was keen to try this in a real-world context.

As it turned out, MongoDB’s document-oriented structure was a great fit for my idea of a fast, searchable, color-coded notepad in the cloud. Each “note” is modeled as a document in a MongoDB collection, and full-text searches across the documents in the collection are extremely efficient. Thanks to MongoLab’s browser-based management, it was also very easy to configure and connect the MongoDB database to the PHP application running on Bluemix.

notes

The end result is a low-overhead mobile Web application that lets you store, categorize and search free-form text notes in the cloud. Check it out on Github, or read more in this IBM developerWorks article.

Build a PHP App that Uses GPS Data From an IoT Device

For many people, the Internet of Things is…well, the Next Big Thing. It’s all about using the cloud, real-time data, and new sensor technology to collect, store and analyze information from a wide range of previously-unwired sources: your house, your car, your refrigerator, your pet and so on.

While IoT is certainly very exciting, it’s hard to figure out exactly how to get started building IoT applications…especially if you’re a Web developer without a background in electrical engineering (like me). So I decided to invest a few weekends in learning about IoT and seeing if I could actually get a working IoT application up and running in PHP.

That’s where the Internet of Things Foundation (IoTF) service came in. A hosted cloud service that’s available through IBM Bluemix, IoTF makes it super-easy to aggregate real-time streams for devices and do something useful with them. After a little bit of research, I was able to successfully use it to retrieve GPS coordinates from my Android smartphone and then combine that data with the Google Maps API (and a little bit of PHP glue) to plot my phone’s location on a map in real time.

php-iotIt’s a simple application, but it goes a long way towards demonstrating the potential of IoT applications…and it’s also given me the foundation I need to begin building more complex applications. If this sounds like something you’d like to get in on as well, take a look at my IBM developerWorks article about using IoT with PHP, and also has some code for you to get started with.

Build and Deploy an Investment Tracking Application in the Cloud with IBM Bluemix

Financial data is now more accessible than ever via open APIs. This makes it easy to build Web or mobile applications that let you track your investment portfolio on a minute-by-minute basis (or at least as often as you care to check it). That’s the idea behind my new portfolio tracking application, which lets you create a virtual portfolio of stocks and then shows you the current market value at any given point.

How does it work? It’s mainly driven off the Quandl API, which is free to use and offers access to both open and premium financial databases. The Quandl API supports thousands of datasets, but I’m only using the free WIKI dataset, which is a community-curated list of end-of-day stock prices and dividends for 3,000 US companies.

The application itself is written in PHP using the Silex micro-framework and uses a hosted Cloudant instance for data storage. jQuery Mobile ensures that the interface works well on smartphones, and the entire thing is hosted on Bluemix for maximum scalability. There’s also a little bit of HybridAuth in the mix, just so that every user can create his or her own account in the system using existing Google credentials.

Sounds interesting? Try a demo, check out the source code on Github, or read about how I developed it in this two-part IBM developerWorks article.