Formal:
* "Attendance at the safety training is mandatory for all employees."
* "The new policy makes wearing face masks in public spaces mandatory."
* "The government has made it mandatory for all citizens to register their vehicles."
Informal:
* "Wearing a helmet is mandatory when riding a motorcycle."
* "It's mandatory to bring your own lunch for the school field trip."
* "I guess it's mandatory to have a social media account these days."
You can also use "mandatory" in a more nuanced way:
* "While not mandatory, it is strongly recommended that you wear a mask."
* "The company's dress code is not mandatory, but it is expected that employees dress professionally."
Note: "Mandatory" usually refers to something that is required or obligatory, often by law or regulation.