[ad_1]
I am quite new to Composer. But I see the point in it.
So, for my plugins I do:
composer require htmlburger/carbon-fields
The problem is… since I am including the “Carbon Fields” package into multiple plugins… composer isn’t doing what it’s best at, which is: handle dependencies to only load it once.
So… how should I structure a WordPress project, to depend on Carbon Fields, but only include it once?
Thanks.
[ad_2]
You don’t. Each plugin should have everything it needs on it’s own, because they’re technically separate projects.
When you run your “composer require” command, it downloads everything into the vendor directory and links it to your project, so everything is included if you want to distribute the plugin.
Yes that means that you may have multiple copies of the same files, just in different plugin directories, but that’s not something to worry about.