I come from a "traditional" PHP paradigm where views are mixed with processing logic. And now switching from WordPress to CraftCMS (which so far is a beautiful experience) I am having trouble with building custom logic.
For example, something as easy as integrating a backend for a webhook endpoint or processing a form is easily done when the "view" is mixed with the "controller", as in WordPress themes.
I like the fact that CraftCMS uses twig to avoid this mixup (I see many advantages in this approach), but I haven't found documentation regarding this topic.
We have a folder with all the index.twig, content.twig ... but no "controllers" folder.
How do we add PHP logic to a "template" view?