Do PHP and IoT Have a Future Together?

Bruno Skvorc

It’s IoT Week at SitePoint! All week we’re publishing articles focused on the intersection of the internet and the physical world, so keep checking the IoT tag for the latest updates.

A whole week of mostly IoT resources on every channel and, yes, that includes PHP. What? “PHP and IoT!? Surely you’re mistaken!”, you must be thinking. No, dear reader. PHP and IoT go well together – better than one might expect.

Robot elephant

In this post, we’ll list some getting started resources. Throughout the remainder of the week, we’ll have some amazing hands on posts for you – everything from creating a drinks machine with PHP, to a real life alarm when a door in Minecraft opens (yes, really!) – and that’s just on our channel. Be sure to check out the others, too!

Without further ado, here’s some introductory material for you if you feel like dabbling before we dive in properly!


  • Electronic Components: when starting out, it’s sometimes difficult to know how to use electronic components, or how to plug them into a circuit. This little guide by the excellent Christopher Pitt is helpful for figuring out a handful of common components.
  • Arduino: a neat hobbyist development platform. It abstracts the steps from resisters and wires to functional computation. You program Arduino boards using C/C++, and this guide will fill in the details to get you started…
  • Onion IoT: a hardware platform like Arduino, but allegedly more flexible and more language agnostic, in that it also supports PHP. The devices and addons are fairly cheap, and very easy to mix and match with other hardware, from generic electronics to Arduinos.
  • Intel Developer Zone Hardware Store: Intel’s developer zone contains a nice catalogue of hardware designed specifically for IoT. Well, not really – it’s just your general purpose electronics – but all bundles together into one store focused on IoT. So if ordering online is more your forte, this is the place to get equipped.
  • Gas sensors: when I was in grade school, I built a breathalyzer with LEDs showing the alcohol level for a competition. Those were arguably simpler times for building stuff, but it was much, much more complicated to find proper hardware. These days, things are reverse – the hardest part to find was a gas based resistor sensor, and that’s exactly what sites like these have to offer.

Software and Tutorials

  • Firmata (JavaScript based): when you’re starting out with Arduino, you may not have the time or desire to learn C/C++ just to be able to program a board. Luckily you don’t have to. This guide introduces Firmata, in one of the many languages that can communicate with it.
  • MakeyMakey: electronics can be super fun for kids! Get them started with the MakeyMakey. It emulates a keyboard/joystick, which you can make your favorite games work with.
  • UnoJoy: if you’ve got an Arduino lying around, and want to turn it into a MakeyMakey, this library is just what you need. It includes conversion kits (and you’ll be able to restore it back to being just an Arduino) and examples.
  • Arduino + Serial PHP Communication: you don’t have to use Firmata to control your Arduino. This guide demonstrates how to create a custom serial communication channel between PHP and your Arduino. It’s a good place to start when you need to use special C/C++ controlled components alongside a PHP application.
  • Arduino + Firmata PHP Communication
  • Power LED bulbs with PHP and Arduino
  • Gorilla PHP Extension: Once you’ve got Firmata running on your Arduino, you’ll need a sweet communication library for your PHP applications to tie into. This is it!
  • Onion IoT Cloud: the true entry point to the “cloud” and the real internet in Internet of Things, the aforementioned Onion hardware platform has this dedicated app cloud for deploying Onion apps and connecting your various devices and electronics
  • Build a PHP app that uses GPS data from an IoT device: Develop PHP apps for the Internet of Things with IBM Watson IoT Platform, Bluemix, and MQTT. Turn your Android phone into a GPS sensor that constantly publishes its location to the Bluemix cloud. Then, connect a PHP application with this data stream and use it to track the location of the Android phone in real time in your web browser.
  • A simple PHP library to communicate with Azure IoT Hub: an introductory tutorial to a PHP library which can be used to communicate with the Azure IoT hub.

What next?

Now that you’re equipped to get started, go ahead and dabble. Think of ideas, imagine scenarios, and go out to your electronics store to get a $10 fistful of hardware – by the time you’re back, we’ll have plenty of hands-on tutorials for you.

Have any more resources that might fit into this list? Let us know in the comments, and happy IoTing!