Raspberry Pi with PHP (or Arduino/ESP8266/NodeMCU) to GPIO to Relay to Gate/Garage Trigger

Have you looked at ST_Anything? It is able to create a 6-button controller using an ESP32 very easily, without much effort. But, please explain in detail what you are trying to accomplish, as I’d hate to steer you wrong.