题
我正在尝试通过composer安装TCPDF。它的工作原理,但不幸的是,它总是安装也整体。有93MB的git目录。我只想安装TCPDF文件没有。git的东西。
怎么做?
这是我的作曲家。json格式:
{
"name": "myprojects/project1",
"require": {
"yiisoft/yii": "~1.1.15",
"twbs/bootstrap": "~3.2.0",
"tecnick.com/tcpdf": "~6.0.89",
"phpoffice/phpexcel": "~1.8.0"
}
}
先谢谢你.
编辑1:
以下是从packagist repo下载的TCPDF composer文件中的composer配置-不确定这是否有助于解决问题:
{
"name": "tecnick.com/tcpdf",
"version": "6.0.089",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.",
"keywords": ["PDF","tcpdf","PDFD32000-2008","qrcode","datamatrix","pdf417","barcodes"],
"license": "LGPLv3",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"homepage": "http://nicolaasuni.tecnick.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"fonts",
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
}
编辑2:
我通过添加配置选项"首选-安装"更改了composer配置如下 :"dist",但没有帮助。我也试过"dev-master",还是一样。..:-(
{
"name": "myprojects/project1",
"config": {
"preferred-install" : "dist"
},
"require": {
"yiisoft/yii": "~1.1.15",
"twbs/bootstrap": "~3.2.0",
"tecnick.com/tcpdf": "~6.0@stable",
"phpoffice/phpexcel": "~1.8.0"
}
}
解决方案
避免克隆的一般建议
如果你得到整个目录,它必须是要么,因为你设置 --prefer-source
安装时,或者你有一个 preferred-install
配置值设置为 source
, ,或者您安装dev-master包,在这种情况下,Composer默认使用源安装(git clone)。
解决方案取决于确切的情况,并且您没有提供足够的细节来说明哪个是正确的,但您很可能可以使用其中任何一个来修复它:
- 套装
--prefer-dist
安装时 - 使用方法
composer config preferred-install dist
永久设置标志 - 通过要求确保只安装标记的版本
"tecnick.com/tcpdf": "~6.0@stable"
, ,那么它应该总是默认选择dist包。
Github或bitbucket上未托管的软件包的特殊情况:
https://packagist.org/packages/tecnick.com/tcpdf 实际上托管在sourceforge上,它不支持从任何git修订版自动构建zip。因此,packagist目前无法为您提供拉链,因此composer必须克隆回购协议。
目前唯一的解决方案是让维护人员将包移动到github,如果只是作为只读镜像。
https://github.com/tcpdf-clone/tcpdf 存在但不知道官方维护与否。如果是,或者它至少是可信的,那么可以选择将tcpdf包的packagist url更改为github。
不隶属于 StackOverflow