我有以下composer.json
{
"name": "mjohnson/transit",
"type": "library",
"description": "A file uploader, validator, importer and transformer library.",
"keywords": [
"transit", "file", "uploader", "validator", "importer", "transformer", "transporter",
"image", "audio", "video", "text", "application", "archive", "s3", "glacier"
],
"homepage": "http://milesj.me/code/php/transit",
"license": "MIT",
"authors": [
{
"name": "Miles Johnson",
"homepage": "http://milesj.me"
}
],
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"ext-mbstring": "*",
"aws/aws-sdk-php": "2.0.*"
},
"support": {
"source": "https://github.com/milesj/php-transit"
},
"autoload": {
"psr-0": { "Transit": "src/" }
}
}
当我运行composer update
源代码时,源代码不会更新以反映当前存储库:https://github.com/milesj/transit
我试图删除锁定文件,成功。试过composer [update|install}
例如,我当前的(本地)代码:
src/Transit/File.php
:
[...]
public function __construct($path) {
if (!file_exists($path)) {
throw new IoException(sprintf('%s does not exist', $path));
}
$this->_path = $path;
}
[...]
当前存储库代码:
[...]
public function __construct($path) {
if (is_array($path)) {
if (empty($path['tmp_name'])) {
throw new IoException('Passing via array must use $_FILES data');
}
$this->_data = $path;
$path = $path['tmp_name'];
}
if (!file_exists($path)) {
throw new IoException(sprintf('%s does not exist', $path));
}
$this->_path = $path;
// @version 1.3.2 Rename file to add ext if ext is missing
if (!$this->ext()) {
$this->rename();
}
// @version 1.4.0 Reset the cache
$this->_cache = array();
}
[...]
您有错误的composer.json
.你提到的那个是关于名为"mjohnson/transit"的库的 - 如果你不是在开发这个确切的软件,那么这是错误的。
您应该创建一个新的 composer.json 文件,至少包含以下行:
{ "require": { "mjohnson/transit" : "*" } }
然后运行composer install
.
我不知道你做了什么来获取那个composer.json
文件,但如果你最初克隆了另一个存储库,现在编辑那个文件,事情就会崩溃!备份您的代码(如果有)。尝试撤消您做错的事情,而无需撤消自己的代码。