How to add functionality

I need to process a form and send results in an e-mail. For this I’d like to use Swiftmailer.

In another thread I read the advice of putting additional PHP files outside of /user, e.g. /app and do the processing there. While this works fine of course, I wonder if there is a better way, as I’d like to use the existing composer setup of grav for swiftmailer and the class loader and potentially other modules.

So I’d like to get some advice how to add functionality, is a custom plugin the way to go? If so, is there a tutorial for plugin development or another recommendation?

We actually plan on releasing our forms plugin along with the admin plugin. This does exactly what your asking.

I would advise you to do what you need to get it working for now, the update it and use the forms plugin when it’s available.

Thank you for your reply! I’m going to use a separate composer subsystem inside my form handler for now as it doesn’t add much. When the form plugin is out, I am definitely looking at that.

This is a solid option, we’re doing the same thing in a couple of plugins.

You might want to ensure you use composer update --no-dev so the .git folders are not included (they can be very large).