We introduce a shear experiment that quantitatively reproduces the main laws of seismicity. By continuously and slowly shearing a compressed monolayer of disks in a ringlike geometry, our system delivers events of frictional failures with energies following a Gutenberg-Richter law. Moreover, foreshocks and aftershocks are described by Omori laws and interevent times also follow exactly the same distribution as real earthquakes, showing the existence of memory of past events. Other features of real earthquakes qualitatively reproduced in our system are both the existence of a quiescence preceding some main shocks, as well as magnitude correlations linked to large quakes. The key ingredient of the dynamics is the nature of the force network, governing the distribution of frictional thresholds.