Air showers generated by cosmic rays interacting in the atmosphere emit short radio pulses. Features of the primary cosmic ray, such as the atmospheric depth of shower maximum ($X_{max}$) and full Stokes parameters, can be reconstructed from the measured signal and have been shown to be in good agreement with modern theory. The LOFAR radio telescope is particularly well suited to measure cosmic rays because it is able to sample the radiation pattern on the ground with hundreds of densely spaced antennas. The position of $X_{max}$ can be determined to within ~20 g/cm$^2$, allowing for mass composition studies close to $10^{17}$ eV where the transition from Galactic to extragalactic sources is expected to occur. In this talk the status of the LOFAR cosmic-ray program as well as future extensions will be presented.