Search by

tmonier / sylius-digital-product-passport-plugin

thibmonier

Digital Product Passport plugin for Sylius 2: open and versioned sustainability data model (origin, recyclability, repairability), public passport page, no regulatory compliance promise

Package info

github.com/thibmonier/sylius-digital-product-passport-plugin

Type:sylius-plugin

pkg:composer/tmonier/sylius-digital-product-passport-plugin

Statistics

Installs: 121

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 4

v0.3.0 2026-10-30 21:16 UTC

README

Build

🇫🇷 Version française

Open and versioned sustainability data model for Sylius 2 products: origin, recyclability, repairability, with a public passport page.

Important: This plugin provides a preparatory data model aligned with ESPR (EU) 2024/1781. It makes NO promise of regulatory compliance until delegated acts by product category are published.

Features

  • Versioned data model: a passport per product variant (product identifier, origin of materials, recyclability, repairability), with a version number and a revision history (PassportRevision, recorded by PassportRevisionService).
  • Public passport page: /product-passport/{id}, readable without an account, in English and French, showing the data, the passport version and the date of the last update. A passport with no data filled in is treated as unpublished and returns a 404.
  • Link from the product page: a "Product Passport" link in the product summary of the shop, through the sylius_shop.product.show.content.info.summary Twig hook.
  • JSON export: DigitalProductPassport::toJson() returns the passport with its schema version (schemaVersion).
  • GS1 Digital Link and QR code: when the passport product identifier is a valid GTIN (8, 12, 13 or 14 digits, check digit verified), the admin product edit page shows a "Labels" tab with the GS1 Digital Link (https://id.gs1.org/01/{GTIN}) and its QR code (SVG). An invalid GTIN is reported in the tab.
  • Compatible spare parts (optional): when tmonier/sylius-customer-asset-management-plugin is installed and the passport has an equipment model code, the public page lists the variants compatible with that equipment model, with a link to their product page; a disabled product is listed as unavailable, without link. Without that plugin, the block is not shown.
  • Passport on the machine page (optional, customer-asset-management ^0.2.1): on the page of a machine of the customer's fleet, a block links to the published passport of its equipment model (same equipment model code) and lists its compatible spare parts. A model without a published passport shows no block.

Planned for later versions: an admin interface to edit passports, SVG and PNG download of the QR code, more data fields.

Installation

composer require tmonier/sylius-digital-product-passport-plugin

Enable the plugin in config/bundles.php:

return [
    // ...
    Tmonier\SyliusDigitalProductPassportPlugin\TmonierSyliusDigitalProductPassportPlugin::class => ['all' => true],
];

Import the routes, for example in config/routes/tmonier_digital_product_passport.yaml:

tmonier_digital_product_passport:
    resource: '@TmonierSyliusDigitalProductPassportPlugin/config/routes.yaml'

Run the migrations:

bin/console doctrine:migrations:migrate

Usage

There is no admin screen to edit passports yet: passports are created in code (fixtures, import or a command of your own), for example:

$passport = new DigitalProductPassport();
$passport->setProductVariant($variant);
$passport->setOriginMaterials('France, Germany');
$passport->setRecyclability('100% recyclable');
$passport->setRepairability('Repairability index: 8/10');
$passport->setProductIdentifier('01234567890128'); // GTIN, used for the GS1 Digital Link
$passport->setEquipmentModelCode('FORKLIFT_X'); // optional, customer-asset-management equipment model
$entityManager->persist($passport);
$entityManager->flush();

The product page then links to the public page /product-passport/{id}.

Screenshots

Public product passport page, as rendered in the Sylius B2B demo. Labels follow the shop locale; field values are stored as entered.

Public product passport page (English)

Public product passport page (French)

Requirements

  • PHP 8.2 or higher
  • Sylius 2.2.9+ or 2.3+
  • Symfony 7.4 or 8.0 (tested in CI)

Development

make install        # Install dependencies
make test           # Run tests
make phpstan        # Run PHPStan
make ecs            # Check coding standards
make quality        # Run all quality checks

Regulatory Context

This plugin anticipates the Digital Product Passport obligation from ESPR (EU) 2024/1781:

  • Batteries: February 18, 2027 (Regulation (EU) 2023/1542, Art. 77)
  • Other categories: indicative roadmap (textiles Q4 2027, furniture 2028, etc.)

Disclaimer: This plugin provides a preparatory data structure. It makes NO guarantee of regulatory compliance until delegated acts define the exact data requirements for each product category.

Author

Thibaut Monier – AI Delivery Manager / Tech Lead

License

MIT License. See LICENSE for details.

Links