So I am trying to prepare my plugin for distribution. My plugin uses Composer for its dependency management. I wrote almost all of the business logic as a separate composer package, because I read, that this would be a good practice.

This is my plugin file:

namespace WpCommands;

// We need to include the autoload from composer
require_once __DIR__ . '/vendor/autoload.php';

use the16thpythonist\Wordpress\WpCommands;
use the16thpythonist\Command\Command;
use Log\LogPost;
use the16thpythonist\Wordpress\Data\DataPost;


And in my development environment this works perfectly fine.

Then I upload the whole plugin folder (including the vendor folder) to github and when I tried cloning the folder into a different WordPress setup on a different environment, it gave me this error:

enter image description here

I just don't know what I am supposed to do. One solution would obviously be to require anyone who wants to install the plugin to also have composer installed. But I think most hosting services don't offer that much freedom?

How can I make an installation work with just committing the whole vendor folder?

  • Have run composer install or update bevor you copy the vendor directory? It is necessary that Composer create the autoload file. Also you should export a plugin structure, there only have the necessary files, not all composer dependencies. – bueltge Jan 3 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.