CHESHIRE — Since the 1990s, William Petit said, Cheshire Academy was a “safe place” for his family. His two daughters would play on the campus fields and his wife, Jennifer, served as co-director of the school’s Richmond Health Center for 10 years.

More than 10 years after Petit’s wife and two daughters were infamously killed in Cheshire during a 2007 home invasion, Petit, a former doctor who now serves as a Republican state representative in Plainville, delivered the commencement address to about 112 graduates at Cheshire Academy’s 224th graduation ceremony Saturday.

Bowden Hall, the oldest building at the boarding school, features eight pillars representing the character traits expected on campus. For the future, Petit advised the graduates to keep in mind three pillars that had supported him through the aftermath of the tragedy: kindness, hope and perseverance.

“The world is vastly different today than it was when I was your age,” he said. “Be an active participant in that change. Your lives should not be a spectator sport.”

Petit recalled that, in the aftermath of losing his family to violence, the community supported him; they visited his parents’ home at all hours to be with him, even when he said he was spending up to 20 hours in bed each day. As president of the Petit Family Foundation, Petit said, he remembers operating in a waking daze, with the board members gently guiding him along to run the foundation’s business.

“When a friend is in need, do not say, ‘Call me when you need me,’” he said. It is imperative actually to show up for those you love in times of need, he said. “I persevered because of the kindness of others.”

In his first term as a legislator, Petit sponsored legislation that would give tax credits to corporations for donating to scholarship funds that help low-income students attend nonpublic schools.

Salutatorian Fengshuo Yang, who received three senior academic awards, told students about the ancient Chinese philosopher and founder of Taoism, Lao-Tzu, reminding his fellow graduates that good and bad are not binary concepts, but in fact exist simultaneously in everything.

“The only thing changing is change itself,” he said, quoting the philosopher.

One’s attitude has the ability to shape his or her entire perspective, Yang said.

Class President Jemimah Frempong said, nine months earlier, the class of 2018 could not wait to graduate. On Saturday, she said the class was left with many memories.

“Cheshire Academy provided us with our firsts, and not all of our experiences were good, but we grew as individuals,” she said. “Like caterpillars, it is time to leave our cocoons and fly.”