ZF2作曲家用法安装新模块

时间:2013-09-24 09:54:23

标签: php module zend-framework2 composer-php

我在使用composer安装ZF2组件时遇到了一些问题。

我知道如何使用ZF2,但现在我想让作曲家的用户获得模块 进入我现有的项目比通过zip下载它们容易得多。

我找到了如何通过作曲家建立一个新项目:

composer create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application --stability dev
将我的骨架应用程序重命名为项目名称之后

好的,我的问题。我想通过作曲家安装ZcfBase模块但我得到了以下问题;

我将项目的作曲家价值添加到我自己的作曲家中;

{
    "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.*"
    },

    "name": "zf-commons/zfc-base",
    "description": "A set of genetic (abstract) classes which are commonly used across multiple modules.",
    "type": "library",
    "keywords": [
        "zf2"
    ],
    "homepage": "https://github.com/ZF-Commons/ZfcBase",
    "authors": [
        {
            "name": "Evan Coury",
            "email": "me@evancoury.com",
            "homepage": "http://blog.evan.pro/"
        },
        {
            "name": "Kyle Spraggs",
            "email": "theman@spiffyjr.me",
            "homepage": "http://www.spiffyjr.me/"
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "zendframework/zend-db": "~2.1",
        "zendframework/zend-eventmanager": "~2.1",
        "zendframework/zend-loader": "~2.1",
        "zendframework/zend-modulemanager": "~2.1",
        "zendframework/zend-mvc": "~2.1",
        "zendframework/zend-servicemanager": "~2.1",
        "zendframework/zend-stdlib": "~2.1"
    },
    "autoload": {
        "psr-0": {
            "ZfcBase": "src/"
        },
        "classmap": [
            "./Module.php"
        ]
    }
}

我运行'composer update'并在'composer install'之后返回:

  [RuntimeException]                                                                                
  Could not scan for classes inside "./Module.php" which does not appear to be a file nor a folder 

我眼中的供应商结构有点奇怪;

enter image description here

我习惯了这种结构(不使用作曲家)

enter image description here

希望有人能以正确的方式通过正确的方式对我进行转弯。

提前致谢! :)

1 个答案:

答案 0 :(得分:2)

/var/www/中运行您的命令:

composer create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application --stability dev

创建一个文件夹:/var/www/skeleton-application/

您需要做的就是:

进入此文件夹:

cd /var/www/skeleton-application/

安装ZfcBase模块:

composer.phar require zf-commons/zfc-base:dev-master

这相当于:[project_name]:branch

要查找其他模块的项目名称,请进入他们的composer.json并检查“名称”:https://github.com/ZF-Commons/ZfcBase/blob/master/composer.json

希望这有帮助!

相关问题