user269867
user269867

Reputation: 3982

Integrate PHPExcel in Zend Framework 2

Using composer I have downloaded the PHPExcel class. The directory structure is

codeplex 
+-phpexcel  
  +-PHPExcel

now I am confuse how to enable PHPExcel class in application.config.php OR should i remove the extra folder structure?

I know it's a basic question but I am just getting fatal error around enabling this.

Upvotes: 0

Views: 1927

Answers (2)

drigani
drigani

Reputation: 1

PhpExcel class is not a ZF2 module in self and for that you don't be able to enable it through the application.config.php file. In alternative you can use MvlabsPHPExcel module that gives the possibility to use PHPOffice/PHPExcel library into a ZF2 application.

To add the module through composer simply:

$ php composer.phar require mvlabs/mvlabs-phpexcel

After that, you'll be able to add it in your application.config.phpfile.

<?php
return [
    'modules' => [
        // ...
        'MvlabsPHPExcel',            
    ],
    // ...
];

Upvotes: 0

Tim Fountain
Tim Fountain

Reputation: 33148

PHPExcel is not a ZF2 module, so you don't need to do anything to enable it. Since you've installed it via. Composer, Composer will have setup the autoloading for you, so you should be able to use the PHPExcel classes in your existing module(s):

use PHPExcel;

$excel = new PHPExcel(); 

[etc.]

Upvotes: 2

Related Questions