2

我在Symfony2 和 Google API 集成之前使用过这个

我对此有疑问,当我使用 compser.json 中的类映射时,我能够访问 Google_Client 类,但是我无法使用任何其他类。

例如,我想使用Goole_YoutubeService. 我有...

$client = new \Google_Client();
$youtube = new \Google_YoutubeService($client);

当我这样做时,我的代码可以识别Google_Client(),但找不到Google_YoutubeService().

我错过了一些东西来让它工作吗?

这是我的 composer.json

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" },
        "classmap": ["vendor/google/google-api-php-client/src","vendor/google/google-api-php-clien‌​t/src/contrib"]

},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "google/google-api-php-client": "1.0.0"

},
"require-dev": {
    "phpunit/phpunit": "3.7.*",
    "phake/phake": "1.*"
},
"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"config": {
    "bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "branch-alias": {
        "dev-master": "2.2-dev"
    }
},
"repositories": [
{
    "type": "package",
    "package": {
        "name": "google/google-api-php-client",
        "version": "1.0.0",
        "source": {
            "type": "svn",
            "url": "http://google-api-php-client.googlecode.com/svn",
            "reference": "trunk"
        }
    }
}
]
}
4

1 回答 1

3

试试Google_YouTubeService - 大写的YouTube - 它会起作用

于 2013-08-06T15:31:11.657 回答