bitexpert / sylius-product-document-plugin
Product document plugin for Sylius.
Package info
github.com/bitExpert/sylius-product-document-plugin
Type:sylius-plugin
pkg:composer/bitexpert/sylius-product-document-plugin
Requires
- php: ^8.4
- sylius/sylius: ^2.0
Requires (Dev)
- behat/behat: ^3.16
- bitexpert/phpstan-sylius: ^0.3.0
- dbrekelmans/bdi: ^1.4
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- ergebnis/composer-normalize: ^2.52
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.4
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.6
- friends-of-behat/variadic-extension: ^1.6
- madewithlove/license-checker: ^3.1
- nyholm/psr7: ^1.8
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ^0.3
- sylius/sylius-rector: ^3.7
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.4
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/maker-bundle: ^1.67
- symfony/runtime: ^6.4 || ^7.4
- symfony/var-exporter: ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.2
- symplify/easy-coding-standard: ^11.0 || ^12.0 || ^13.0
- vincentlanglet/twig-cs-fixer: ^4.0
Conflicts
- sylius/grid-bundle: <1.15
- symfony/flex: <2.4
This package is auto-updated.
Last update: 2026-06-30 09:48:13 UTC
README
The Product Document Plugin for Sylius allows you to attach documents (e.g. PDFs, images) to products and organize them by configurable document types.
Create document types in the admin:
Attach documents to a product:
Download the Documents in the storefront:
Features
- Manage document types with translatable names and sortable positions
- Attach multiple documents to a product, organized by document type
- Download documents in the storefront and in the admin
- Control document visibility: public for all visitors or restricted to logged-in customers
Requirements
- PHP 8.4 or higher
- Sylius 2.0 or higher
Installation
- Install the plugin via Composer
composer require bitexpert/sylius-product-document-plugin
- Enable the plugin
<?php # config/bundles.php return [ // ... BitExpert\SyliusProductDocumentPlugin\BitExpertSyliusProductDocumentPlugin::class => ['all' => true], ];
- Import config
# config/packages/_sylius.yaml imports: # ... - { resource: "@BitExpertSyliusProductDocumentPlugin/config/config.yaml" }
- Import routing
# config/routes/bitexpert_product_document.yaml bitexpert_product_document_admin: resource: "@BitExpertSyliusProductDocumentPlugin/config/routes/admin.yaml"
- Configure the
Productentity insrc/Entity/Product/Product.php
Add the BitExpert\SyliusProductDocumentPlugin\Model\HasProductDocumentsInterface interface and the BitExpert\SyliusProductDocumentPlugin\Entity\Trait\HasProductDocumentsTrait trait to the entity.
<?php declare(strict_types=1); namespace App\Entity\Product; use BitExpert\SyliusProductDocumentPlugin\Entity\Trait\HasProductDocumentsTrait; use BitExpert\SyliusProductDocumentPlugin\Model\HasProductDocumentsInterface; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Product as BaseProduct; #[ORM\Entity] #[ORM\Table(name: 'sylius_product')] class Product extends BaseProduct implements HasProductDocumentsInterface { use HasProductDocumentsTrait; public function __construct() { parent::__construct(); $this->initializeProductDocumentsCollection(); } }
- Update your database schema
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
Tests
You can run the unit tests with the following command (requires dependency installation):
./vendor/bin/phpunit
Contribution
Feel free to contribute to this module by reporting issues or creating pull requests for improvements.
To run the Test Application included in the repo, refer to the Sylius Test Application docs. If you are using DDEV you can run the following commands to bootstrap the Test Application in Docker:
ddev start
ddev bootstrap
Credits
This plugin was inspired by the AsdoriaSyliusProductDocumentPlugin by Asdoria and has been rebuilt from scratch for Sylius 2.
License
The Sylius Product Document Plugin for Sylius is released under the MIT license.


