Faulhaber Encoder Question

Can someone post a sample code for a magnetic rotary encoder.

Would I place channel A & B into the digital, or analogue pins. and why are there two channels? don't you just need one? :~