Roots Discourse

Execute script through forms

Hi guys,

So I’m using sage and bedrock (although I think the bedrock part isnt too relevant here?). What I am trying to do is use this calendar ICS generator within my theme:

I essentially need to create a form which on submit uses the above code to generate a downloadable ICS file.

I think I have figured out the way to do this with normal Wordpress but what I would like to know is if there is a better “roots” way to do this? Ideally with controllers but I’m not certain of a few things.

Would the ICS.php (in the git linked above) be its own controller?
Can I refer to that controller in another controller if it is its own controller?
How do I handle $_POST requests from a form with sage?

Ideally I would like to create a form and the action be something like create_ics.php which would handle this but I dont really know how to properly do that in sage.

Thanks