Ex-Liverpool midfielder Danny Murphy has confirmed his retirement from football after a 20-year career.