In this paper we present a thorough first-principles density functional theory based computational study of the structural stability, electronic, magnetic, and optical properties of pristine and doped gallium phosphide (GaP) monolayers. The pristine GaP monolayer is found to have a periodically buckled structure, with an indirect band gap of 2.15 eV. The doping by X (B, Al, In, C, Si, Ge, Sn, Zn, and Cd) at the Ga site, and Y (N, As, Sb, O, S, Se, Te, Zn, and Cd) at the P site is considered, and an indirect to direct band gap transition is observed after doping by In at the Ga site. For several cases, significant changes in the band gap are seen after doping, while the system becomes metallic when O is substituted at the P site. The spin-polarized band structures are calculated for the monolayers with doping-induced magnetism, and we find that for some cases a direct band gap appears for one of the spin orientations. For such cases, we investigate the intriguing possibility of spin-dependent optical properties. Furthermore, for several cases the band gap is very small for one of the spin orientations, suggesting the possibility of engineering half metallicity by doping. For the layers with direct band gaps, the calculated optical absorption spectra are found to span a wide energy range in the visible and ultraviolet regions. The computed formation energies of both the pristine and doped structures are quite small, indicating that the laboratory realization of such structures is quite feasible. On the whole, our results suggest that the doped GaP monolayer is a material with potentially a wide range of applications in nanoelectronics, spintronics, optoelectronics, solar cells, etc.