【发布时间】:2012-08-11 17:57:03
【问题描述】:
我正在尝试将 OSExcelBundle 插件集成到我的 Symfony2 项目中。 我已经按照 README 教程进行操作,其中提到了以下内容
Add this line to the require option in your composer.json file:
"os/excel-bundle": "dev-master"
Add autoloader for PHPExcel in app/autoloader.php
require __DIR__.'/../vendor/os/php-excel/PHPExcel/PHPExcel.php';
Execute this command line
php composer.phar install
为了能够执行 php 命令行,我必须从 http://www.getcomposer.org 下载 composer 并将可执行文件放入包中。当我运行它时,我有以下错误
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for os/excel-bundle == 1.0.0.0 -> satisfiable by os/excel-bundle 1.0.0.
- Can only install one of: os/excel-bundle dev-master, os/excel-bundle 1.0.0.
- Installation request for os/excel-bundle dev-master -> satisfiable by os/excel-bundle dev-master.
这是我安装 symfony2 插件所经历的其他步骤
1 - 我将插件放在 vendor/bundle 目录中,使其与以下路径匹配
vendor/bundle/OS/ExcelBundle
2 - 我已将此行添加到 app/AppKernel.php 文件中
new OS\ExcelBundle\OSExcelBundle(),
3 - 我按照上面的 README 进行操作
这是 Json
{
"name": "os/excel-bundle",
"description": "OS Excel Bundle for Symfony2",
"keywords": ["excel"],
"homepage": "http://github.com/ouardisoft/OSExcelBundle",
"type": "symfony-bundle",
"license": "MIT",
"authors": [
{
"name": "LOUARDI Abdeltif",
"email": "louardi.abdeltif@yahoo.fr",
"homepage": "http://phphub.net"
}
],
"require": {
"php": ">=5.2.6",
"os/php-excel": "dev-master",
"os/excel-bundle": "dev-master"
},
"autoload": {
"psr-0": { "OS\\ExcelBundle": "" }
},
"target-dir": "OS/ExcelBundle"
}
【问题讨论】:
-
os/excel-bundle 在您的 composer.json 文件中出现了多少次?
-
这里两次。我正在添加 Json
-
这看起来像是 bundle 的 composer 文件,你项目的文件是怎么说的(你有吗)?您使用的是 2.0 还是 2.1 哪个版本的 Symfony? Symfony 2.0 标准版不使用 Composer,它使用一个 deps 文件。
标签: php symfony composer-php