I need to use this Git project in my plugin.

First I drop source code in a folder, and load it with

require_once dirname(__FILE__) . '/vendor/Frozensheep/RightmoveADF/RightmoveADF.php';

But there is a problem, because although apparently one Class (for instance GetBranchPropertyList) is loaded by the namespace use:

    use Frozensheep\RightmoveADF\Request\GetBranchPropertyList;

I get an error when invoke the class:

   return new GetBranchPropertyList();

Fatal error: Uncaught Error: Class 'Frozensheep\RightmoveADF\Request\GetBranchPropertyList' not found

The project includes a composer.json, which I think is what I need to install and configure, but I have no idea how to use it.

Can someone explain me step by step how to proceed with composer.json config?


Composer generates the autoloader for you. Thus, you don't need to require a specific file from vendor packages. All you need to do is require the composer autoloader:

Change require_once dirname(__FILE__) . '/vendor/Frozensheep/RightmoveADF/RightmoveADF.php'; to require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php';

In some cases, classes still not be found. Re-generate the composer autoloader by $ composer dump-autoload.

Usually, you should not mess with the vendor directory. If you did, I suggest you remove the vendor directory and re-install packages by $ rm -dr vendor/ and $ composer install

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.