Heat butter or olive oil in a large pot over medium heat.
Sauté onions until translucent, 3–4 minutes. Add garlic and cook 1 minute until fragrant.
Stir in chopped artichokes and cook 2–3 minutes.
Add spinach and cook until wilted (fresh) or heated through (frozen).
Pour in broth and bring to a simmer for 5 minutes.
Reduce heat and add cream cheese, stirring until melted and fully incorporated.
Blend soup with an immersion blender or in batches in a countertop blender until smooth and creamy.
Stir in Parmesan cheese and season with salt, pepper, and red pepper flakes.
Heat gently, adjust seasoning, and serve warm.