Using PHPExcel in Zend Framework 2

For programming and general questions on Zend Framework
Post Reply
prueba2306
Posts: 1
Joined: Sat May 08, 2010 7:21 pm

Using PHPExcel in Zend Framework 2

Post by prueba2306 » Sat Nov 10, 2012 12:45 am

Hello everyone:

I been using Zend Framework 1 for a while and now Im trying to jump in Zend Framework 2.

I use PHPExcel with ZF1 to generate Excel files dinamically and i don't have problems but i'm trying to use it with ZF2 but i have some problems with the configuration (is not so simple to install/configure any library in ZF2 as in ZF1). I tried to find a solution with Google but the "solutions" are incorrect, incomplete or not clear enough to understand.

Does anyone know what i have to do to use PHPExcel with ZF2? I need to know what configurations i need to do (and where) to use it (maybe some step-by-step answer of how to install/configure any external library in ZF2 would be great).

Thanks for your time and help.

dieg1737
Posts: 1
Joined: Fri Mar 17, 2017 10:18 pm

Re: Using PHPExcel in Zend Framework 2

Post by dieg1737 » Fri Mar 17, 2017 10:23 pm

For an easy integration of PHPOffice/PHPExcel library into zend framework 2, you can use the zf2 module MvlabsPHPExcel.

After that you need to enable the `MvlabsPHPExcel` module:

Code: Select all

<?php
    return [
        'modules' => [
            // ...
            'MvlabsPHPExcel',            
        ],
        // ...
    ];
And after that you be able to use inside the controller.

Code: Select all

$phpExcelObject = $this->serviceLocator->get('mvlabs.phpexcel.service')->createPHPExcelObject();

Post Reply