Nanophotonic technologies offer great promise for ultra-low power optical signal processing, but relatively few nonlinear-optical phenomena have yet been explored as bases for robust digital modulation/switching~cite{Yang07,Fara08,Liu10,Noza10}. Here we show that a single two-level system (TLS) coupled strongly to an optical resonator can impart binary phase modulation on a saturating probe beam. Our experiment relies on spontaneous emission to induce occasional transitions between positive and negative phase shifts---with each such edge corresponding to a dissipated energy of just one photon ($approx 0.23$ aJ)---but an optical control beam could be used to trigger additional phase switching at signalling rates above this background. Although our ability to demonstrate controlled switching in our atom-based experiment is limited, we discuss prospects for exploiting analogous physics in a nanophotonic device incorporating a quantum dot as the TLS to realize deterministic binary phase modulation with control power in the aJ/edge regime.