On stage, alone, a man is talking. He’s talking about Mrs Rayner, the teacher who opened up the world to him, who made him decide at the age of seven to visit China one day and see the dragons he was learning about. He’s talking about the joy of becoming a teacher himself, of the idealism he felt, of the children he reached and the transformative power of education.

And he’s talking about the bullying, the pressure, the stress, the disillusionment. He’s talking of conversations with the child trying to learn on an empty stomach, the student who threatened him with a knife, the headteacher who wanted more than he could give, the pupils – and colleagues – who derided him for being gay.

He’s talking of how painful memories of his childhood resurface when abused children seek his help, how his private life is shattered by his work, and how – over and over – he is driven to ask: should I stay in teaching, or should I go?

Put your hands up, the audience is told each time: you decide.

“We meet this teacher – it’s my experiences, but it could be any teacher – at breaking point,” says Matthew Roberts, the secondary teacher who wrote this moving one-man play on his phone during his daily commute. He will perform it in London later this month and at the Edinburgh Fringe.

“The idea of asking the audience three times ‘do I stay in teaching or do I leave teaching’ means it becomes a discourse, punctuated with my personal experiences, which is alive.”

It is not his first play: at the Fringe last year he performed Canoe, another one-man show he wrote about a gay couple wrongly blamed for their children’s accidental deaths. Critics described it as “a sad story, but a beautiful, heartfelt and, at times, uplifting piece of writing”, a description that could easily be applied to Teach, his new play.

“I wanted to write from the heart, after the success of Canoe,” says Roberts, who teaches English at the Drapers’ academy in Romford, greater London. “Someone said: ‘you’ve been a teacher for 16 years, why don’t you write about teaching?’ My first reaction was: oh no, that’s too personal – because of the ripple effect of where that could go. But the ripple effect has been profound.”

Writing the play was cathartic, he says. “Obviously, as a piece of art it is there to entertain, to make people laugh, cry and think. But I feel healed by it. I feel I have survived. There’s a strength in that.”

The play, he says, is about survival, and how hard – and important – it is for teachers to cling on to their integrity when the goalposts keep moving.

“I’m thinking about the state of education and the changes in the curriculum that have happened and are going to happen. And I’m looking at how to keep true to yourself as an educator and those beliefs of wanting the best for every child.”

He started out teaching drama but retrained as an English teacher two years ago, after cuts to arts education undermined his ability to teach the subject he loved: “I couldn’t condone the changes they had made.” Politicians, he rages in the play, are starving teachers intellectually.

The play also touches on the teacher’s emotional vulnerability in the classroom. “When you’re in a space where a safeguarding disclosure is made and you don’t know about some of your stuff from your own past, that can be extraordinary.”

Painful memories of his child-hood have been reawakened by the children he has taught. “Every person is a door and they open things in your heart and mind.”

As a teacher, he knows he must be able to hear something awful that’s happening to a student and hold back his own feelings. “As a human being, you break down later … and then go and teach your next class.”

Teachers are physically vulnerable too, he points out. He recounts in the play how, after a student he told off went berserk, he once had to email all staff: “Student has violently threatened to cut me up and [wants me to] come outside the room to fight. Please help. Room 211.” He also reveals he picked up a knife himself, as a child, to protect someone he loved: “That kid could have been me.” He has never forgotten the strength of his own teachers and the protection and sanctuary school offered him.

Throughout the 50-minute play he quotes depressing statistics from How to Survive in Teaching, a book by Dr Emma Kell about the state of teaching and the education system in the UK. “I wanted to make the personal political.” He hopes less experienced teachers who watch the play will get “immunity for what’s going to come in your career”.

Roberts says he felt “broken” by the constant pressure after his first five or six years as a teacher. “It is a nightmare. There’s that saying from Confucius: ‘choose a job you love and you’ll never have to work a day in your life’. But what if the job you love is causing you harm? There’s only so much you can take.”

He has periodically considered giving up teaching, but each time has found the strength – and what he describes as “pockets of joy” – to stay. Moving schools has helped: “Every place is different, every ethos is different. There are amazing teachers out there.”

By sharing his experiences he aims to give hope to others that they, too, can survive and rediscover their love of teaching: “We can be made whole.”

Teach will be at CentrE17, Walthamstow, on 25-26 July and at the Fringe