PHPackages                             codyas/spreadsheet-bundle - 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. codyas/spreadsheet-bundle

ActiveSymfony-bundle

codyas/spreadsheet-bundle
=========================

A Symfony bundle to integrate with PHPOffice's PhpSpreadsheet library

01↓75%PHP

Since Jul 16Pushed 1mo agoCompare

[ Source](https://github.com/codyas-team/spreadsheet-bundle)[ Packagist](https://packagist.org/packages/codyas/spreadsheet-bundle)[ RSS](/packages/codyas-spreadsheet-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PhpSpreadsheet Bundle for Symfony
=================================

[](#phpspreadsheet-bundle-for-symfony)

> This README is AI generated for documentation purposes. This project is based on . The source code in this repository is also AI generated.

This bundle integrates PhpSpreadsheet with Symfony applications and provides a simple service-based factory for creating, reading, writing, and streaming spreadsheet files.

It is built around the latest supported PhpSpreadsheet package release in this repository and is intended for Symfony 6 and Symfony 7 applications.

Features
--------

[](#features)

- Provides a reusable Spreadsheet factory service
- Creates new spreadsheets or loads existing files
- Creates readers and writers for supported PhpSpreadsheet formats
- Streams spreadsheet downloads as Symfony responses
- Optional Twig integration with helper functions

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 6.0 or 7.0
- PhpSpreadsheet ^5.9

Installation
------------

[](#installation)

Install the bundle with Composer:

```
composer require codyas/spreadsheet-bundle
```

Then enable the bundle in your Symfony application:

```
// config/bundles.php
return [
    SpreadsheetBundle\PhpSpreadsheetBundle\PhpSpreadsheetBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

The bundle supports a minimal configuration option for enabling Twig helpers:

```
# config/packages/spreadsheet_bundle.yaml
spreadsheet_bundle:
    twig: true
```

Usage
-----

[](#usage)

### Inject the factory service

[](#inject-the-factory-service)

```
use SpreadsheetBundle\PhpSpreadsheetBundle\Factory\SpreadsheetFactory;
use Symfony\Component\HttpFoundation\Response;

final class ExportController
{
    public function __construct(private readonly SpreadsheetFactory $factory)
    {
    }

    public function export(): Response
    {
        $spreadsheet = $this->factory->createSpreadsheet();
        $sheet = $spreadsheet->getActiveSheet();
        $sheet->setCellValue('A1', 'Hello Symfony');
        $sheet->setCellValue('B1', 'PhpSpreadsheet');

        return $this->factory->createStreamedResponse(
            $spreadsheet,
            'Xlsx',
            200,
            [
                'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
                'Content-Disposition' => 'attachment; filename="export.xlsx"',
            ]
        );
    }
}
```

### Load an existing spreadsheet

[](#load-an-existing-spreadsheet)

```
$spreadsheet = $this->factory->createSpreadsheet('/path/to/file.xlsx');
```

### Create a reader or writer

[](#create-a-reader-or-writer)

```
$reader = $this->factory->createReader('Xlsx');
$writer = $this->factory->createWriter($spreadsheet, 'Csv');
```

Twig integration
----------------

[](#twig-integration)

When Twig support is enabled, the bundle registers two Twig functions:

- `spreadsheet_create()` creates a new spreadsheet instance
- `spreadsheet_to_html()` renders a spreadsheet as HTML

Example:

```
{% set spreadsheet = spreadsheet_create() %}
{{ spreadsheet_to_html(spreadsheet) }}
```

Service reference
-----------------

[](#service-reference)

The bundle registers the following service:

- `spreadsheet_bundle.factory`

The factory class is:

- `SpreadsheetBundle\PhpSpreadsheetBundle\Factory\SpreadsheetFactory`

License
-------

[](#license)

This package is licensed under the MIT License.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance60

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9855836?v=4)[Leonardo D. Antúnez](/maintainers/leoantunez)[@leoantunez](https://github.com/leoantunez)

---

Top Contributors

[![leoantunez](https://avatars.githubusercontent.com/u/9855836?v=4)](https://github.com/leoantunez "leoantunez (2 commits)")

### Embed Badge

![Health badge](/badges/codyas-spreadsheet-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/codyas-spreadsheet-bundle/health.svg)](https://phpackages.com/packages/codyas-spreadsheet-bundle)
```

PHPackages © 2026

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