我正在编写一个库作为编写器包,它需要官方的PHP Google API客户端。这个api客户端只能在Github上找到——packagists上的版本只是分叉,似乎不经常更新。
我在添加官方API客户端作为包的依赖项时遇到了一个问题。你知道我做错了什么吗?
{
"name": "mechastorm/google-spreadsheet-extractor",
"require": {
"google/google-api-php-client": "dev-master"
},
"require-dev": {
"google/google-api-php-client": "dev-master",
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.9"
},
"minimum-stability" : "dev",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/google/google-api-php-client.git"
}
],
"autoload": {
"psr-0" : {
"mechastorm\google-spreadsheet-extractor" : "src"
}
}
}
我得到的错误是
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mechastorm/google-spreadsheet-extractor dev-master -> satisfiable by mechastorm/google-spreadsheet-extractor[dev-master].
- mechastorm/google-spreadsheet-extractor dev-master requires google/google-api-php-client dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
这里可以看到,要包含Google的PHP API,只需将这一行放入编写器中。Json require block
"google/apiclient": "1.0.*@dev"
你的解决方案应该也可以,但是你应该指定一个不同的版本。
如果你使用的是带有composer的git仓库,你应该指定一个标签作为版本号。