Melt the butter or heat the oil in a medium saucepan over a medium-high heat until it shimmers.
Add the finely chopped onion and cook, stirring occasionally, until translucent, about 3–5 minutes.
Stir in the minced garlic and cook until fragrant, about 1 minute.
Add the rice and toast it for 1–2 minutes, stirring, until the grains look slightly opaque.
Pour in the stock and season with salt, black pepper and dried parsley (if using), then stir to combine.
Bring to the boil over a medium-high heat, then reduce to a low heat, cover and simmer undisturbed for 15 minutes.
Remove from the heat and rest, covered, for 5–10 minutes, allowing the rice to finish cooking in its own steam.
Uncover, fluff up the rice with a fork and serve warm as a savoury side dish.