Two superconductors coupled by a weak link support an equilibrium Josephson electrical current which depends on the phase difference $varphi$ between the superconducting condensates [1]. Yet, when a temperature gradient is imposed across the junction, the Josephson effect manifests itself through a coherent component of the heat current that flows oppositely to the thermal gradient for $ varphi <pi/2$ [2-4]. The direction of both the Josephson charge and heat currents can be inverted by adding a $pi$ shift to $varphi$. In the static electrical case, this effect was obtained in a few systems, e.g. via a ferromagnetic coupling [5,6] or a non-equilibrium distribution in the weak link [7]. These structures opened new possibilities for superconducting quantum logic [6,8] and ultralow power superconducting computers [9]. Here, we report the first experimental realization of a thermal Josephson junction whose phase bias can be controlled from $0$ to $pi$. This is obtained thanks to a superconducting quantum interferometer that allows to fully control the direction of the coherent energy transfer through the junction [10]. This possibility, joined to the completely superconducting nature of our system, provides temperature modulations with unprecedented amplitude of $sim$ 100 mK and transfer coefficients exceeding 1 K per flux quantum at 25 mK. Then, this quantum structure represents a fundamental step towards the realization of caloritronic logic components, such as thermal transistors, switches and memory devices [10,11]. These elements, combined with heat interferometers [3,4,12] and diodes [13,14], would complete the thermal conversion of the most important phase-coherent electronic devices and benefit cryogenic microcircuits requiring energy management, such as quantum computing architectures and radiation sensors.