在当前文件夹中,我安装了 ZFTool
$ cat composer.json
{
"require" : {
"php" : ">=5.3.3",
"zendframework/zftool": "v0.1.0",
"zendframework/zendframework": "2.4.8"
}
}
$ /opt/lampp/bin/php ./vendor/bin/zf.php version
ZFTool - Zend Framework 2 command line Tool
The application in this folder is using Zend Framework 2.4.8
我试试
先安装ZF2再创建项目
$ /opt/lampp/bin/php ./vendor/bin/zf.php install zf proj000 2.4.8
The ZF library 2.4.8 has been installed in proj000.
$ /opt/lampp/bin/php ./vendor/bin/zf.php create project proj000
The directory proj000 already exists. You cannot create a ZF2 project here.
我得到了正确的库版本,但无法创建项目。
先创建项目再安装ZF2
$ /opt/lampp/bin/php ./vendor/bin/zf.php create project proj001
sh: 1: php: not found
PHP Warning: copy(/tmp/composer.phar): failed to open stream: No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 85
Warning: copy(/tmp/composer.phar): failed to open stream: No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 85
PHP Warning: chmod(): No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 87
Warning: chmod(): No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 87
ZF2 skeleton application installed in proj001.
In order to execute the skeleton application you need to install the ZF2 library.
Execute: "composer.phar install" in proj001
For more info in proj001/README.md
$ /opt/lampp/bin/php ./vendor/bin/zf.php install zf proj001 2.4.8
The directory proj001 already exists. You cannot install the ZF2 library here.
当我检查 proj001/composer.json 我看到时,生成了 ZF 2.5 设置
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "~2.5"
}
}
ZFTool 使用 composer.json 创建的项目适用于 ZF 2.5 而不是 ZF 2.4。我无法使用它,因为我使用 PHP 5.4 托管服务器