tmonier / sylius-digital-product-passport-plugin
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
Requires
- php: ^8.2
- endroid/qr-code: ^5.0
- sylius/sylius: ^2.2.9 || ^2.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5
- rector/rector: ^2.0
- sylius-labs/coding-standard: ^4.4
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/css-selector: ^7.4 || ^8.0
- symfony/debug-bundle: ^7.4 || ^8.0
- symfony/dom-crawler: ^7.4 || ^8.0
- symfony/dotenv: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/intl: ^7.4 || ^8.0
- symfony/runtime: ^7.4 || ^8.0
- symfony/web-profiler-bundle: ^7.4 || ^8.0
- symfony/webpack-encore-bundle: ^2.2
- tmonier/sylius-customer-asset-management-plugin: ^0.2.1
Suggests
- tmonier/sylius-customer-asset-management-plugin: Displays compatible spare parts on the public passport page when equipment model is linked
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-31 16:56:00 UTC
README
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 byPassportRevisionService). - 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.summaryTwig 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-pluginis 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.
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.

