PHPackages                             spiriitlabs/excel-rust - 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. spiriitlabs/excel-rust

ActiveLibrary

spiriitlabs/excel-rust
======================

v0.1.0-beta(1y ago)23PHPCI passing

Since Feb 14Pushed 1y ago2 watchersCompare

[ Source](https://github.com/SpiriitLabs/php-excel-rust)[ Packagist](https://packagist.org/packages/spiriitlabs/excel-rust)[ RSS](/packages/spiriitlabs-excel-rust/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (15)Versions (2)Used By (0)

Spiriit Excel Rust
==================

[](#spiriit-excel-rust)

This PHP library leverages the power of Rust to create Excel files quickly and efficiently.

[![PHP Version](https://camo.githubusercontent.com/d22b42013860d48ab72ede0e94a1406ea74ef398da08c54784df6eb8fb72d8cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737069726969746c6162732f657863656c2d72757374)](https://packagist.org/packages/spiriitlabs/excel-rust)[![Latest Stable Version](https://camo.githubusercontent.com/e3c36f959eba71cb9a59092c362eb2e1c3b4420ece60140fb219ff578b728bba/68747470733a2f2f706f7365722e707567782e6f72672f737069726969746c6162732f666f726d2d66696c7465722d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/spiriitlabs/excel-rust)[![CI Tests](https://github.com/SpiriitLabs/excel-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/SpiriitLabs/excel-rust/actions/workflows/ci.yml)

Why choose Rust?
----------------

[](#why-choose-rust)

Rust is renowned for its execution speed and memory safety, making it an excellent choice for intensive tasks like generating Excel files. By combining PHP for data management with Rust for heavy processing, you get optimal performance without sacrificing the simplicity of PHP code.

How it works
------------

[](#how-it-works)

Thanks to a Rust binary, whose source code is available on the [GitHub repository](https://github.com/SpiriitLabs/excel_gen), it is possible to generate Excel rows and formats directly from PHP. The data and configuration are transmitted to the binary using the **AVRO** format ([learn more about AVRO](https://avro.apache.org/)).

Once the data is received, the Rust binary uses the **excelrust** library to create the Excel file.

READY for PROD ?
================

[](#ready-for-prod-)

Yes! We already this in production on large files.

Install
=======

[](#install)

```
composer require spiriitlabs/excel-rust
```

Download the last release of the rust binary
============================================

[](#download-the-last-release-of-the-rust-binary)

Go at [https://github.com/SpiriitLabs/excel\_gen](https://github.com/SpiriitLabs/excel_gen/tags)

Save the binary somewhere

Symfony bundle
==============

[](#symfony-bundle)

Just active the bundle in your `bundles.php`

```
Spiriit\Rustsheet\Symfony\Bundle\ExcelRustBundle::class => ['all' => true],
```

Create a file in the folder packages

> config/packages/spiriit\_excel\_rust.yaml

```
excel_rust:
  rust_binary: '%rust_binary%' # path to rust binary
  avro_codec: 'null' # default to null, because we don't need to compress the file
```

You need to use the `AsExcelRust` attribute

```
use Spiriit\Rustsheet\Attributes\AsExcelRust;

#[AsExcelRust(name: 'my_super_excel')] // override name is optionnal
class MyExcel implements ExcelInterface
{
...
}
```

```
class MyController
{
    public function __invoke(ExcelRust $excelRust)
    {
        $output = $excelRust->generateExcelFromAvro('MyExcel', __DIR__.'/myexcel_avro.xlsx');
    }
}
```

Use the library in standalone
=============================

[](#use-the-library-in-standalone)

Use a builder
-------------

[](#use-a-builder)

First create a class implements `ExcelInterface` and add attribute 'AsExcelRust'

```
class MyExcel implements ExcelInterface
{
    public function buildSheet(WorkbookBuilder $builder): void
    {
        $builder = $builder
            ->setDefaultStyleHeader(
                Format::new()
                    ->fontName('Arial')
                    ->fontSize(20)
            );

        $worksheet = Worksheet::new()
            ->setName('Worksheet1');

        $worksheet->writeCell(new Cell(columnIndex: 0, rowIndex: 0, format: null, value: 'Item'));
        $worksheet->writeCell(new Cell(columnIndex: 1, rowIndex: 0, format: null, value: 'Cost'));
        $worksheet->writeCell(new Cell(columnIndex: 2, rowIndex: 0, format: Format::new()->bold(), value: 'Date'));
        $worksheet->writeCell(new Cell(columnIndex: 3, rowIndex: 0, format: Format::new()->bold(), value: 'Autre'));

        $worksheet->writeCell(
            new Cell(
                columnIndex: 0,
                rowIndex: 1,
                format: null,
                value: 'test'
            ),
        );
    }
}
```

Then create a new instance of ExcelRust and prepare the WorkbookFactory and the excel\_rust binary:

```
    $factory = new \Spiriit\Rustsheet\WorkbookFactory();

    $exportAvro = new ExportAvro(
        schema: file_get_contents(__DIR__.'/../schema.json')
    );

    $excelRust = new ExcelRust(
        workbookFactory: $factory,
        rustGenLocation: __DIR__ . '/path/to/excel_gen',
        exportAvro: $exportAvro,
    );

    $output = $excelRust->generateExcelFromAvro(new MyExcel(), __DIR__.'/myexcel_avro.xlsx');
```

From HTML file
--------------

[](#from-html-file)

```
    $factory = new \Spiriit\Rustsheet\WorkbookFactory();

    $excelRust = new ExcelRust(
        workbookFactory: $factory,
        rustGenLocation: __DIR__ . '/path/to/excel_gen',
    );

    $htmlFile = 'test.html';

    $excelRust->generateExcelFromHtml($htmlFile, $output);
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity24

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

458d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1807e890fb651ea404b659ae9e720c3d71020b13ed4385faaf79ae77d45fb3c6?d=identicon)[SpiriitLabs](/maintainers/SpiriitLabs)

---

Top Contributors

[![gilles-g](https://avatars.githubusercontent.com/u/377875?v=4)](https://github.com/gilles-g "gilles-g (22 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spiriitlabs-excel-rust/health.svg)

```
[![Health](https://phpackages.com/badges/spiriitlabs-excel-rust/health.svg)](https://phpackages.com/packages/spiriitlabs-excel-rust)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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