无法安装symfony2 OSExcelBundle软件包

时间:2012-08-15 12:30:55

标签: php symfony composer-php

我正在尝试在我的Symfony2项目中集成OSExcelBundle插件。 我已经阅读了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并将可执行文件放在bundle中。当我运行它时,我有以下错误

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"
}

1 个答案:

答案 0 :(得分:0)

Symfony 2.0标准版不使用composer,它使用deps文件和供应商脚本。仔细阅读this

您需要将供应商库添加到项目deps文件中并运行php bin/vendors install以将其安装到您的供应商文件夹中。

或者升级到2.1,您可以使用Composer。