0

我正在尝试将 OSExcelBundle 插件集成到我的 Symfony2 项目中。我遵循了自述文件教程,其中提到了以下内容

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 - 我按照上面的自述文件

这是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"
}
4

1 回答 1

0

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

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

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

于 2012-08-15T15:16:29.563 回答