If a vector field $\mathbf{F}(x,y)$ is conservative, $\mathbf{F}(x,y) = \nabla \phi(x,y)$ for some function $\phi(x,y)$.
The function $\phi(x,y)$ can be found by integrating each component of $$\mathbf{F}(x,y) = \nabla \phi(x,y) = \partial_x \phi(x,y) \ \mathbf{i} + \partial_y \phi(x,y) \ \mathbf{j}$$ and combining the results into a single function $\phi$.