Roots Discourse

Sould composers be deprecated by components?

In my humble opinion, I’ve found composers (or what used to be controllers) an inferior way compared to components

Composers must be aware of where they are used

which feels like an anti-pattern (children must not be aware of it’s parent)
take this example: https://github.com/roots/sage/blob/10.0.0-dev/app/View/Composers/Post.php
the code must include all sections where the view will be used

In a component, this limitation doesn’t exist.

Global vs Local vars

Global vars have obvious disadvantages like name collisions.

Where does this variable come from?

In a component, it’s always super clear where variables come from. Not so in a composer

what are your thoughts about this?