Approximate moon phase algorithm from Meeus' Astronomical Algorithms
$$
\begin{align*}
T &= (jd-2451545)/36525.0; \\
D &= 297.8501921 + 445267.1114034T - 0.0018819T^2 + 1.0/545868.0T^3 - 1.0/113065000.0T^4 \\
M &= 357.5291092 + 35999.0502909T - 0.0001536T^2 + 1.0/24490000.0T^3 \\
M' &= 134.9633964 + 477198.8675055T + 0.0087414T^2 + 1.0/69699.0T^3 - 1.0/14712000.0T^4 \\
i &= D - 6.289 \sin M' + 2.1\sin M -1.274\sin(2D - M') - 0.658 \sin 2D - 0.214\sin2M' - 0.11\sin D \\
\end{align*}
$$
Where i is the phase angle from 0°-360°