In this paper we propose and numerically investigate an all-optical temporal integrator based on a photonic crystal cavity. We show that an array of photonic crystal cavities enables high-order temporal integration. The effect of the value of the cavity’s free spectral range on the accuracy of the integration is considered. The influence of the coupling coefficients in the resonator array on the integration accuracy is demonstrated. A compact integrator based on a photonic crystal nanobeam cavity is designed, which allows high-precision integration of optical pulses of subpicosecond duration.