rotary encoder help

I am hoping someone can tell me, or make me, a library for rotary encoders.
very simply put I want in to detect speed, direction and if at all possible distance/degrees.
I was thinking of using the push button as a sort of Home key so that you could calibrate it if that helps

Have you read any of this as a starting point?