Walys yes, just install the Composer package and add the line(s) to extend.php.
extend.php is outside of the vendor folder so is not impacted by Flarum updates. It stays enabled just like an extension.
There's always a small risk for breaking changes in future Flarum versions, and there could be a need to update the code in extend.php later on to fix such a breaking change. But if that happens I'll add instructions to the discussion/README of the package.