PHPackages                             akyos/ux-export - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. akyos/ux-export

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

akyos/ux-export
===============

A Symfony bundle for export in live Component

1.1.1(7mo ago)162proprietaryPHPPHP ^8.1

Since Jun 6Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/akyoscommunication/ux-export)[ Packagist](https://packagist.org/packages/akyos/ux-export)[ RSS](/packages/akyos-ux-export/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (12)Used By (0)

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require akyos/ux-export
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require akyos/ux-export
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Akyos\UXExportBundle\UXExportBundle::class => ['all' => true],
];
```

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

[](#configuration)

The bundle writes generated files under `ux_export.path`. The default path is `%kernel.project_dir%/var/export/`. It can be overridden in `config/packages/ux_export.yaml`:

```
ux_export:
    path: '%kernel.project_dir%/var/export/'
```

Defining Exportable Entities
----------------------------

[](#defining-exportable-entities)

Mark your entities with `#[Exportable]` and use `#[ExportableProperty]` to control what is exported. Properties or methods tagged with these attributes are listed in the export when their `groups` option matches the group passed to the exporter. You may also rely on Symfony's `#[Groups]` attribute as a fallback.

Usage of Exportable Attributes
------------------------------

[](#usage-of-exportable-attributes)

`ExportableProperty` exposes several options:

- `groups`: serializer groups allowed for this column.
- `name`: override the column header.
- `position`: integer used to order columns.
- `fields`: extract sub-fields from a related entity.
- `fields`: extract sub-fields from a related entity. When omitted, fields having the same group on the related entity are exported automatically.
- `manyToMany`: set to `lines` to duplicate rows for each relation or to `sheet` to create an additional worksheet listing the intermediate table.

Example:

```
#[ExportableProperty(groups: ['export'], fields: ['name', 'email'], manyToMany: ExportableProperty::MODE_SHEET)]
private Collection $users;
```

### Exporting Nested Fields

[](#exporting-nested-fields)

The `fields` option allows you to export specific properties from a related entity. If omitted, the exporter will automatically include every property of the child entity that belongs to the selected group:

```
#[Exportable]
class Order
{
    #[ExportableProperty(groups: ['export'], fields: ['firstName', 'lastName'])]
    private ?Customer $customer = null;
}
```

### Many-to-many Relations

[](#many-to-many-relations)

Use the `manyToMany` option when dealing with collections:

```
// duplicate one row per related entity
#[ExportableProperty(groups: ['export'], manyToMany: ExportableProperty::MODE_LINES)]
private Collection $tags;

// or create a dedicated worksheet listing the relations
#[ExportableProperty(groups: ['export'], manyToMany: ExportableProperty::MODE_SHEET)]
private Collection $roles;
```

### Export Values from Methods

[](#export-values-from-methods)

Methods can also be exported:

```
#[Exportable]
class User
{
    #[ExportableProperty(groups: ['export'], name: 'Full name', position: 1)]
    public function getFullName(): string
    {
        return $this->firstName.' '.$this->lastName;
    }
}
```

Live Component Integration
--------------------------

[](#live-component-integration)

Include `ComponentWithExportTrait` in a Symfony UX Live Component. Implement `getData()` to provide the dataset (an array, a Doctrine `QueryBuilder` or a `Query`). Set the `$class` property so the trait can read your entity metadata:

```
use Akyos\UXExportBundle\Trait\ComponentWithExportTrait;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;

#[AsLiveComponent]
class UserTableComponent
{
    use ComponentWithExportTrait;

    public string $class = User::class;
    public ?string $exportGroup = 'default';

    private UserRepository $repository;

    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }

    public function getData(): iterable
    {
        return $this->repository->createQueryBuilder('u')->getQuery();
    }
}
```

Calling the `export` action generates the file and redirects the browser to the download route provided by the bundle.

### Export Formats

[](#export-formats)

The trait supports two formats controlled by the `$exportType` property:

- `xlsx` (default)
- `csv`

When exporting to CSV, a file is created for each worksheet. If some `ExportableProperty` fields use the `manyToMany` option set to `sheet`, an additional CSV is generated for that relation and all files are zipped together.

### Using CSV Export

[](#using-csv-export)

Set the trait's `$exportType` property to `csv` and optionally customize `$exportFileName` when you prefer CSV instead of XLSX:

```
#[AsLiveComponent]
class UserTableComponent
{
    use ComponentWithExportTrait;

    public string $class = User::class;
    public string $exportType = 'csv';
    public string $exportFileName = 'users';
    public ?string $exportGroup = 'default';

    private UserRepository $repository;

    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }

    public function getData(): iterable
    {
        return $this->repository->createQueryBuilder('u')->getQuery();
    }
}
```

The bundle will generate a single CSV by default. If one of your `ExportableProperty` definitions uses `manyToMany: ExportableProperty::MODE_SHEET`, multiple CSV files will be produced and automatically zipped.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance62

Regular maintenance activity

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~17 days

Total

3

Last Release

229d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0712a2a59177f1f0b0e6be094ae8db913fcde12ed95915eb8b89992f66afade8?d=identicon)[AkyosDev](/maintainers/AkyosDev)

---

Top Contributors

[![akyoscommunication](https://avatars.githubusercontent.com/u/50996280?v=4)](https://github.com/akyoscommunication "akyoscommunication (24 commits)")[![JOULKVAJohan](https://avatars.githubusercontent.com/u/64126256?v=4)](https://github.com/JOULKVAJohan "JOULKVAJohan (9 commits)")

---

Tags

phpsymfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/akyos-ux-export/health.svg)

```
[![Health](https://phpackages.com/badges/akyos-ux-export/health.svg)](https://phpackages.com/packages/akyos-ux-export)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[pugx/autocompleter-bundle

Add an autocomplete type to forms

93861.6k3](/packages/pugx-autocompleter-bundle)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[sineflow/clamav

ClamAV PHP Client for Symfony

10168.5k](/packages/sineflow-clamav)

PHPackages © 2026

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