PHPackages                             11ya/excelbundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. 11ya/excelbundle

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

11ya/excelbundle
================

This is a Symfony2 Bundle helps you to read and write Excel files (including pdf, xlsx, odt), thanks to the PHPExcel library

v2.0(13y ago)0153MITPHP &gt;=5.3.2

Since Sep 28Compare

[ Source](https://github.com/11ya/ExcelBundle)[ Packagist](https://packagist.org/packages/11ya/excelbundle)[ Docs](http://www.welcometothebundle.com)[ RSS](/packages/11ya-excelbundle/feed)WikiDiscussions Synced 6d ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Symfony2 Excel bundle
=====================

[](#symfony2-excel-bundle)

This bundle permits you to create an easily modifiable excel object. This is just a dependency injection that links

3 Objects:

- The container in this bundle,
- The StreamWrapper in the n3bStreamresponse
- A Writer.

You could create your own writer extending `n3b\Bundle\Util\HttpFoundation\StreamResponse\StreamWriterInterface` or you could use the great PHPExcel library. With PHPExcel you can create xls, ods, pdf and more.

You have to know that csv is faster so I encourage you to use the built-in function for csv: [http://it.php.net/manual-lookup.php?pattern=csv&amp;lang=en&amp;scope=quickref](http://it.php.net/manual-lookup.php?pattern=csv&lang=en&scope=quickref)

Migration
---------

[](#migration)

In order to follow the naming convention  all the liuggio namespaces are migrated to Liuggio.

This master is up-to-date to the symfony/symfony master actually on 2.1

INSTALLATION with COMPOSER
--------------------------

[](#installation-with-composer)

1 Add to composer.json to the `require` key

```
    "require" : {
        "liuggio/excelbundle": ">=1.0.4",
    }

```

2 Register the bundle in `app/AppKernel.php`

```
    $bundles = array(
        // ...
        new Liuggio\ExcelBundle\LiuggioExcelBundle(),
    );
```

INSTALLATION with deps file
---------------------------

[](#installation-with-deps-file)

1 Add to the following to your `deps` file, then run `php bin/vendors install`

```
[PHPExcel]
    git=http://github.com/PHPOffice/PHPExcel.git
    target=/phpexcel
    version=origin/master

[n3bStreamresponse]
    git=git://github.com/liuggio/Symfony2-StreamResponse.git
    target=n3b/src/n3b/Bundle/Util/HttpFoundation/StreamResponse

[LiuggioExcelBundle]
    git=https://github.com/liuggio/ExcelBundle.git
    target=/bundles/Liuggio/ExcelBundle
```

2 Register the namespaces and prefixes in `app/autoload.php`:

```
    $loader->registerNamespaces(array(
        // ...
        'n3b\\Bundle\\Util\\HttpFoundation\\StreamResponse' => __DIR__.'/../vendor/n3b/src',
        'Liuggio'          => __DIR__.'/../vendor/bundles',
    ));
    $loader->registerPrefixes(array(
        // ...
        'PHPExcel'         => __DIR__.'/../vendor/phpexcel/Classes',
    ));
```

3 Enable the bundle in `app/AppKernel.php`

```
    $bundles = array(
        // ...
        new Liuggio\ExcelBundle\LiuggioExcelBundle(),
    );
```

AVAILABLE SERVICES
------------------

[](#available-services)

If you want to write

```
   // create MS Excel5
   $excelService = $this->get('xls.service_xls5');
   // create pdf
   $this->get('xls.service_pdf');
   // create MS Excel 2007
   $this->get('xls.service_xls2007');
```

If you want to read xls

```
    $excelObj = $this->get('xls.load_xls5')->load($filename);
```

USAGE
-----

[](#usage)

Create a controller in your bundle

```
namespace YOURNAME\YOURBUNDLE\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{

    public function indexAction($name)
    {
        // ask the service for a Excel5
        $excelService = $this->get('xls.service_xls5');
        // or $this->get('xls.service_pdf');
        // or create your own is easy just modify services.yml

        // create the object see http://phpexcel.codeplex.com documentation
        $excelService->excelObj->getProperties()->setCreator("Maarten Balliauw")
                            ->setLastModifiedBy("Maarten Balliauw")
                            ->setTitle("Office 2005 XLSX Test Document")
                            ->setSubject("Office 2005 XLSX Test Document")
                            ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
                            ->setKeywords("office 2005 openxml php")
                            ->setCategory("Test result file");
        $excelService->excelObj->setActiveSheetIndex(0)
                    ->setCellValue('A1', 'Hello')
                    ->setCellValue('B2', 'world!');
        $excelService->excelObj->getActiveSheet()->setTitle('Simple');
        // Set active sheet index to the first sheet, so Excel opens this as the first sheet
        $excelService->excelObj->setActiveSheetIndex(0);

        //create the response
        $response = $excelService->getResponse();
        $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8');
        $response->headers->set('Content-Disposition', 'attachment;filename=stdream2.xls');

        // If you are using a https connection, you have to set those two headers for compatibility with IE headers->set('Pragma', 'public');
        $response->headers->set('Cache-Control', 'maxage=1');
        return $response;
    }
}
```

With the right writer (e.g. PHPExcel\_Writer\_Excel5) you could also write the output to a file:

```

	public function indexAction($name)
    {
        $excelService = $this->get('xls.service_xls5');

        //...create php excel object

        $excelService->getStreamWriter()->write( $filename );
    }
```

ADVANCED USE
------------

[](#advanced-use)

If you need to, see and modify `Liuggio\ExcelBundle\Resources\config\services.yml`

Contributors
------------

[](#contributors)

@pivasyk

@dirkbl

@DerStoffel

@artturi

@isqad88

@mazenovi

@jochenhilgers

@Squazic

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 85.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~66 days

Total

5

Last Release

4803d ago

Major Versions

v0.0.8 → v1.0.02012-09-28

v1.0.4 → v2.02013-06-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2795968?v=4)[Ilya Vertakov](/maintainers/11ya)[@11ya](https://github.com/11ya)

---

Top Contributors

[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (59 commits)")[![szchen77](https://avatars.githubusercontent.com/u/1326435?v=4)](https://github.com/szchen77 "szchen77 (4 commits)")[![sethunath](https://avatars.githubusercontent.com/u/905031?v=4)](https://github.com/sethunath "sethunath (2 commits)")[![dirkbloessl](https://avatars.githubusercontent.com/u/811984?v=4)](https://github.com/dirkbloessl "dirkbloessl (1 commits)")[![jebbench](https://avatars.githubusercontent.com/u/1029732?v=4)](https://github.com/jebbench "jebbench (1 commits)")[![ashalaev](https://avatars.githubusercontent.com/u/48551430?v=4)](https://github.com/ashalaev "ashalaev (1 commits)")[![waldo2188](https://avatars.githubusercontent.com/u/841872?v=4)](https://github.com/waldo2188 "waldo2188 (1 commits)")

---

Tags

bundleSymfony2excelxls

### Embed Badge

![Health badge](/badges/11ya-excelbundle/health.svg)

```
[![Health](https://phpackages.com/badges/11ya-excelbundle/health.svg)](https://phpackages.com/packages/11ya-excelbundle)
```

###  Alternatives

[liuggio/excelbundle

This is a Symfony2 Bundle helps you to read and write Excel files (including pdf, xlsx, odt), thanks to the PHPExcel library

3706.4M11](/packages/liuggio-excelbundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[onurb/excel-bundle

Symfony Bundle to read or write Excel file (including pdf, xlsx, odt), using phpoffice/phpspreadsheet library (replacement of phpoffice/phpexcel, abandonned)

15334.9k](/packages/onurb-excel-bundle)[jgrygierek/batch-entity-import-bundle

Importing entities with preview and edit features for Symfony.

121.1M1](/packages/jgrygierek-batch-entity-import-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
