The transformation of phase translations is linked to the generator of the conjugate variable. For phase changes, this is the number operator. Hence, for a phase translation of $\text{d}\varphi$, the unitary transformation performing this shift is
$$\hat{U} = \exp\left[-i\text{d}\varphi\hat{n}\right].$$
I would like to derive a similar unitary transformation for different variables where the generator is initially unknown. To do so, it would be informative to understand how the above equation is derived. Does anyone know how to derive the form of $\hat{U}$ shown above for phase translations so that a similar approach may be taken for different observables?
NOTE
The above is a phase shifter, not a phase operator.