I recently had a job which required me to utilise a bunch of Microchip's MCP23017 16-Bit I/O Expander with Serial Interface. I needed to use a web interface to control the I/O ports, and after spending a bit of time looking around online, I found quite a number of Python modules and a few written in C, but not a lot for php. Dont get me wrong, there are a few around, but most of the ones I found are integrated into other systems and I gave up looking at splitting the code out and ended up writing my own. I decided to post the code to GitHub under the GPL3 license for others to use for free if they choose to.
https://github.com/cwispy/mcp23x17
The module uses the i2c-tools. The README.md file on GitHub provides details on how to install these tools, and how to add the apache webserver to the i2c group so it has permission to read and write from the i2c bus.