我试图通过编写器安装TCPDF。它可以工作,但不幸的是,它总是安装整个。git目录,它有93 MB。我只想安装TCPDF文件没有。git的东西。
怎么做?
这是我的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:
我已经改变了composer的配置如下添加配置选项"preferred-install": "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克隆)。
解决方案取决于具体情况,您没有提供足够的细节来说明哪个是正确的,但您很可能使用以下任何一种来解决它:
- 安装 时设置
- 使用
composer config preferred-install dist
永久设置标志 - 确保你只安装带有
"tecnick.com/tcpdf": "~6.0@stable"
标记的版本,那么它应该默认选择dist包。
--prefer-dist
不在github或bitbucket上托管的包的特殊情况:
https://packagist.org/packages/tecnick.com/tcpdf实际上托管在sourceforge上,它不支持从任何git版本自动生成zip。由于packagist目前无法为您提供zip,因此composer必须克隆repo。
目前唯一的解决方案是让维护者将包移动到github,如果只是作为只读镜像。
https://github.com/tcpdf-clone/tcpdf存在,但我不知道它是否被官方维护。如果是,或者如果它是可信的,那么它将是一个选项,将tcpdf包的packagist url更改为github包。