Php Symfony 2.3添加Google API
我以前用过这个 关于这一点,我有一个问题,当我在compser.json中使用classmap时,我能够访问Google_客户机类,但是我无法使用任何其他类 例如,我想使用Php Symfony 2.3添加Google API,php,symfony,Php,Symfony,我以前用过这个 关于这一点,我有一个问题,当我在compser.json中使用classmap时,我能够访问Google_客户机类,但是我无法使用任何其他类 例如,我想使用谷歌YouTube服务。我有 $client = new \Google_Client(); $youtube = new \Google_YoutubeService($client); 当我这样做时,我的代码识别Google\u Client(),但找不到Google\u YoutubeService() 我是不是错过了
谷歌YouTube服务
。我有
$client = new \Google_Client();
$youtube = new \Google_YoutubeService($client);
当我这样做时,我的代码识别Google\u Client()
,但找不到Google\u 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-client/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"
}
}
}
]
}
试试谷歌YouTube服务-大写YouTube-它会工作做
\contrib\谷歌YouTube服务($client)代码>工作?调用未定义的函数contrib\\Google\u YoutubeService()不,我得到了这个错误,请参见您链接到有关自动加载部分的答案?尝试添加到类映射,如:“类映射”:[“vendor/project/google api php client/src”,“vendor/project/google api php client/src/contrib”]
为您希望从存储库访问的任何其他文件添加文件夹:我将再次尝试,但我已经发布了我的composer.json,也许你可以看看它是否有错误。谢谢!在看了类映射之后,我意识到了这一点。