Controlling laser-beam patterns is indispensable in modern technology, where lasers are typically combined with phase-modulating elements such as diffractive optical elements or spatial light modulators. However, the combination of separate elements is not only a challenge for on-chip miniaturisation but also hinders their integration permitting the switchable control of individual modules. Here, we demonstrate the operation of phase-modulating lasers that emit arbitrarily configurable beam patterns without requiring any optical elements or scanning devices. We introduce a phase-modulating resonator in a semiconductor laser, which allows the concurrent realisation of lasing and phase modulation. The fabricated devices are on-chip-sized, making them suitable for integration. We believe this work will provide a breakthrough in various laser applications such as switchable illumination patterns for bio-medical applications, structured illuminations, and even real three-dimensional or highly realistic displays, which cannot be realised with simple combinations of conventional devices or elements.