The phpgpio extension provides an API to control your GPIO's (with the WiringPi library)