composer does not autoload

2019-03-03 14:28发布

问题:

I followed the composer instructions and installed composer successfully. I want to use tumblr's brand new php api client.

My folder structure:

vendor/
composer.json
composer.lock
myfile.php

composer.json:

{
    "require": {
        "tumblr/tumblr": "0.0.2"
    }
}

myfile.php:

require 'vendor/autoload.php';
$client = new Tumblr\API\Client(CONSUMER_KEY, CONSUMER_SECRET);

Installing using php composer.phar install works great as well. But when executing myfile.php the class could not be found.

Fatal error: Class 'Tumblr\API\Client' not found in [..]/htdocs/tumblr/myfile.php on line 9

回答1:

A new version of tumblr.php has been released which fixes the issue. Thanks to @igorw.