Roots Discourse

Best way to integrate the TypeRocket framework?

Been beating my head against this for several days so I’m asking for help.

I’m trying to use the TypeRocket framework within a Trellis/Bedrock/Sage environment. I believe that it will be a more simplified solution than CPTUI+ACF or some other combination.


According to the install directions, the best way is to include it as an mu-plugin so that it’s not theme dependent and is available anywhere within the WP environment. Unfortunately the documentation expects that to be a manual install instead of as a dependency. (https://typerocket.com/docs/v4/installation/#section-mu-plugin)

  • I do want it as an mu-plugin

  • I do want to be able to leverage its functionality from within Sage templates

  • I don’t want to include it in the theme since I may want to leverage it on API pages.

  • I don’t want to manually force it in as an mu-plugin and include it in source control because that is not my code.


My first issue was that it’s not available through wpackagist and therefore wasn’t controllable via the normal composer installers and the Bedrock mu autoloader. I ended up at this Stackoverflow answer and used the oomphinc/composer-installers-extender package so that I could follow past threads advice and get it into the mu-plugins folder with:


"extra": {

"installer-types": ["library"],

"installer-paths": {

"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin", "typerocket/typerocket"],

This gets it into the web/app/mu-plugins folder but doesn’t actually load it since it also needs an additional file to actually include the init file. require_once('typerocket/init.php');

Adding that file to mu-plugins doesn’t work because TypeRocket is expecting to have been installed as a standalone composer package via composer create-project --prefer-dist typerocket/typerocket. It then checks for its own vendor directory or alternatively looks you to pass in a custom function via TR_AUTO_LOADER. (source code)

I’m digging into the Composer/PSR-0/PSR-4 stuff but don’t feel like I’m going to know the answer when I see it.


The second potential solution is loading it as a normal vendor package but requiring it from within the mu-plugins folder.

The issues with this appear to be several:

  • I still have to manually init it from mu-plugins

  • Some of the assets from the frameworks folders are meant to be publicly accessible via the WPMU_PLUGIN_URL path which can’t be done from the top-level vendor folder without some symlink magic.


So, what’s the best way to accomplish what I’m going for?

  • Suck it up and just include it as a theme dependency?

  • Force-add it as a manual mu-plugin that’s committed with my code?

  • Muck up some kind of Composer script to hook the pre-package-install event and redirect the paths to where it expects to be?

  • Turn it into an Ansible dependency and take Composer out of the equation?

  • Open an issue and wait for the framework to get updated?

  • Give up coding because my conceptions of ‘the right way to do things’ are all wrong and go live on a commune some where?

Thank you for any help or direction you can provide.

This topic was automatically closed after 42 days. New replies are no longer allowed.