Developing a Composer-managed plugin in Trellis environment

I had a plugin I was developing as part of a bedrock codebase, but now moving out and will include with composer.

For development, I tried symlinking the plugin to web/app/plugins/my-plugin, but the files aren’t there in the guest box.

Do I need to change the vagrant configuration, or is there a different recommended approach, like developing the plugin outside of the Trellis project?

Thanks much.

If you install your plugin with --prefer-source it will install as any composer plugin would, but Composer will clone the repo instead of just downloading files. This means you can work on the plugin “in-place” and commit changes back to your repo, no troublesome symlinking necessary.

2 Likes

Ah beautiful. Thank you so much. Will report back once I have done it. You rock. @alwaysblank

Success. It doesn’t look like the composer.json file retains the --prefer-source request.

I ran composer require mynamespace/the_plugin --prefer-source and the .git file is there.

It seemed to be in a detached head state, but maybe there was another reason for that.

Look at your composer.json and see what the version constraint is. If it’s something other than dev-master or * then my guess is that Composer is targeting a specific commit because it sees that as the “version” that meets your constraint.

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