So here is part 1: just the basic steps to rig opening and closing a box
And here is part 2 for a very easy “help” rig to easily open it just by moving an object in object mode: