我正在尝试通过composer安装TCPDF。 它工作,但不幸的是,它总是安装整个.git目录,它有93 MB。 我只想安装没有.git东西的TCPDF文件。
怎么做?
这是我的composer.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编写器文件中的编写器配置 - 不确定这是否有助于解决问题:
{
"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:
我已经通过添加配置选项“preferred-install”:“dist”更改了composer配置,但没有帮助。我也试过“开发大师”,仍然是一样......: - (
{
"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"
}
}
答案 0 :(得分:2)
如果您获得整个目录,则必须是因为您在安装时设置了--prefer-source
,或者您将preferred-install
配置值设置为source
,或者您安装了dev-master包,在这种情况下,Composer默认使用源安装(git clone)。
解决方案取决于确切的情况,并且您没有提供足够的详细信息来说明哪个是正确的,但您很可能使用其中任何一个来修复它:
--prefer-dist
composer config preferred-install dist
永久设置标记"tecnick.com/tcpdf": "~6.0@stable"
,然后默认情况下应始终选择dist包。https://packagist.org/packages/tecnick.com/tcpdf实际上托管在sourceforge上,它不支持从任何git修订版构建自动zip。因此,packagist目前不能为您提供拉链,因此作曲家必须克隆回购。
现在唯一的解决方案是让维护者将包移动到github,如果只是作为只读镜像。
https://github.com/tcpdf-clone/tcpdf存在,但我不知道它是否正式维护。如果是,或者至少它是受信任的那么可以选择将tcpdf包的packagist url更改为github one。