#101099
midimax
Participant

ControlBlock ? (with some additional features)

ControlBlock: Power Switch, Game Controllers, and I/O for the Raspberry Pi

Or if you want to build it completely yourself using MCP23017 like ControlBlock or the “IO Pi” from your second link does is the correct way.