On the SitePoint PHP blog author Christopher Pitt has a new tutorial posted about combining PHP, Arduino and Minecraft and combine the physical and software worlds in an interesting IoT combination.
Some of the most interesting programming I’ve done has been in Minecraft. It’s an open-world, sandbox game developed by Mojang, (recently acquired by Microsoft). Minecraft began as a canvas for creative expression, and while I do very different things in it these days, it still is that for me.
I’m going to take you on a journey, as we build a Minecraft mansion, and then secure it with a real-world alarm system. There’s quite a bit of ground to cover, and though I plan for this to be a two-part series, I’m going to have to leave some of the tangential details for you to discover!
For those not familiar with "programming" in Minecraft (not the backend language, but using things like redstone) he gives a brief introduction. He then sets up the situation - the creation of a "sprawling mansion" in your Minecraft world and a need to secure the front door. He includes the command to set up the "door open" test on a command block. He then shows how to hook this into a loop to continuously test if a door is open or not. With this open/closed door check system in place he then brings PHP into the mix, having it check log files for the "whispers" when the door actions happen. He then creates a watcher for these events and has it respond with a chat message back to the user. That's all in this tutorial but a future part of the series will add on the physical aspect - the Arduino.