Hibernian have confirmed that Liam Craig will join them in the summer after his contract at St Johnstone expires.