Preheat the oven to 375 degrees F.
Stir in the garlic and continue to cook for 1 minute. Remove from the heat and cool completely. In a mixing bowl, combine the onions and cheese. Mix well. Season with salt and pepper.
With a 2 1/2-inch cookie cutter, cut 24 rounds of the puff pastry. Place them on the parchment-lined baking sheet, prick each round randomly with the tines of a fork, and brush with the beaten egg. Spread a tablespoon of the onion mixture on each round, leaving a 1/8-inch border.
Bake until lightly browned, about 15 minutes. Remove from the oven and sprinkle with the parsley. Serve warm.