01 - Preheat oven to 350°F. Lightly grease a 9-inch round pie dish or similar baking dish.
02 - Heat 1 tablespoon olive oil in a large skillet over medium heat. Sauté onion until soft, about 3 minutes, then add garlic and cook 1 minute more.
03 - Add spinach to the skillet and cook until wilted if fresh, or heated through if frozen. Remove from heat and allow to cool slightly.
04 - In a large bowl, mix crumbled feta, ricotta, eggs, Parmesan (if using), dill, nutmeg, pepper, and salt. Incorporate the cooled spinach mixture until well combined.
05 - Place one sheet of phyllo in the prepared dish, letting edges overhang. Brush with olive oil or melted butter. Repeat with 3–4 more sheets, brushing each and rotating to cover all sides with overhang.
06 - Evenly spread the spinach and feta mixture over the layered phyllo base.
07 - Layer remaining phyllo sheets on top, brushing each with oil. Tuck edges down into the sides of the dish to seal.
08 - Use a sharp knife to score the top phyllo layer into serving-sized portions without cutting all the way through.
09 - Bake for 35–40 minutes until the top is golden and crisp.
10 - Allow to cool for 10 minutes before slicing and serving.