在 Zend Framework 2 项目中没有从作曲家安装 TCPDF

Posted

技术标签:

【中文标题】在 Zend Framework 2 项目中没有从作曲家安装 TCPDF【英文标题】:TCPDF not installing from composer in Zend Framework 2 project 【发布时间】:2013-09-07 16:09:10 【问题描述】:

我正在尝试从 composer 安装 TCPDF。这是package的链接。我在 composer.json 中有以下内容


        "name": "zendframework/skeleton-application",
        "description": "Skeleton Application for ZF2",
        "license": "BSD-3-Clause",
        "keywords": [
            "framework",
            "zf2"
        ],
        "homepage": "http://framework.zend.com/",
        "require": 
            "php": ">=5.3.3",
            "zendframework/zendframework": ">2.2.0rc1",
                    "zendframework/zftool": "dev-master",
                    "cgm/zf2-file-upload-examples": ">=1.0.0",
                    "zf-commons/zfc-user": "dev-master",
                    "gowsram/g-maps": "dev-master",
                    "ghislainf/zf2-whoops": "dev-master",
                    "nitecon/zf2-db-session": "1.*",
                    "ghislainf/geonames-server": "v0.9",
                    "aaron4m/zf2-static-pages": "dev-master",
                    "email-zf2/emailzf2": "dev-master",
                    "dkplus/crud": "dev-hotfix/6",

                    "doctrine/doctrine-orm-module": "0.*",
                    "zf-commons/zfc-admin": "dev-master",
                    "zendexperts/ze-theme": "dev-master",
                    "zendframework/zend-developer-tools": "dev-master",
                    "bjyoungblood/bjy-authorize": "dev-master",
                    "bjyoungblood/BjyProfiler": "dev-master",
                    "evandotpro/edp-module-layouts": "dev-master",
                    "doctrine/migrations": "dev-master",
                    "mwillbanks/zfc-twitter-bootstrap": "dev-master",

                    "twig/twig": "~1.0",
                    "leafo/lessphp": "0.3.*@dev",
                    "leafo/scssphp": "dev-master",
                    "leafo/scssphp-compass": "dev-master",
                    "ptachoire/cssembed": "dev-master",
                    "rwoverdijk/assetmanager": "1.*",
                    "hybridauth/hybridauth": "dev-master",
                    "socalnick/scn-social-auth": "dev-master",
                    "aws/aws-sdk-php": "2.*",
                    "doctrine/common": "2.4.*@dev",
                    "doctrine/annotations": "1.0.*@dev",
                    "ircmaxell/random-lib": "1.0.*@dev",
                    "ocramius/proxy-manager": "0.5.*@dev",
                    "zendframework/zendpdf": "2.0.*@dev",
                    "zendframework/zendservice-recaptcha": "2.0.*@dev",
                    "bjyoungblood/bjy-profiler": "dev-master",
                    "ocramius/ocra-service-manager": "dev-master",
                    "doctrine/data-fixtures": "1.0.*@dev",
                    "symfony/dependency-injection": "2.4.*@dev",
                    "symfony/http-kernel": "2.4.*@dev",
                    "doctrine/cache": "1.0.*@dev",
                    "monolog/monolog": "1.6.*@dev",
                    "danielss89/zfc-user-admin": "dev-master",
                    "zf-commons/zfc-user-doctrine-orm": "dev-master",
                    "darkmatus/roleuserbridge": "dev-master",
                    "neilime/zf2-twb-bundle": "1.0"
                    "tecnick.com/tcpdf": "dev-master"
        ,
        "require-dev": 
            "phpunit/phpunit": "3.7.*"
                

当我运行 php composer.phar 更新时,它总是显示以下错误:

Loading composer repositories with package information

更新依赖(包括require-dev) - 安装 tecnick.com/tcpdf (dev-master 6b842db) 克隆 6b842db6c4c42941c7233dc19fffa695f14d4000

[Symfony\Component\Process\Exception\RuntimeException] 进程超时。

如何解决这个错误?或者如果有任何替代方法将 TCPDF 包含在 ZF2 项目中;如果是,请提供一些有关安装和使用的文档。

谢谢

【问题讨论】:

【参考方案1】:

您必须使用以下行提供 url 存储库:

**
"repositories": [
    
         "type":"package",
         "package": 
         "name": "tecnick.com/tcpdf",
         "version":"master",
         "source": 
              "url": "http://git.code.sf.net/p/tcpdf/code", /* or something like that, it's the repo url*/
              "type": "git",
              "reference":"master"
         
    
],
"require": 
     ...

与'require'处于同一级别

【讨论】:

【参考方案2】:

在前面的代码中,我们需要用“”关闭包。

就我而言,我已经通过添加这样的存储库来修复它:

"repositories"     : 
    "sourceforge": 
        "type": "vcs",
        "url": "http://git.code.sf.net/p/tcpdf/code"
    
, 
"require": 
    "php": ">=5.3.3",
    "symfony/symfony": "~2.4",
    [...] Some others [...]
    "whiteoctober/tcpdf-bundle": "dev-master"
,

【讨论】:

以上是关于在 Zend Framework 2 项目中没有从作曲家安装 TCPDF的主要内容,如果未能解决你的问题,请参考以下文章

zend framework如何安装?

zend framework 2 + phpunit + 多模块 + 持续集成

原创Zend Framework 2框架之MVC

原创Zend Framework 2框架之MVC

Zend Framework 2-从控制器返回JSON

Zend Framework 2无法从mail.local.php加载配置