Download the PHP package jkindly/sylius-digital-product-plugin without Composer
On this page you can find all versions of the php package jkindly/sylius-digital-product-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jkindly/sylius-digital-product-plugin
More information about jkindly/sylius-digital-product-plugin
Files in jkindly/sylius-digital-product-plugin
Package sylius-digital-product-plugin
Short Description Sylius Digital Product Plugin
License MIT
Informations about the package sylius-digital-product-plugin
Sylius Digital Product Plugin
Sell digital products in Sylius with uploaded files, external URLs, download limits, and post-payment delivery.
Overview
This plugin adds digital product support to Sylius 2.x.
It lets you:
- mark product variants as digital
- attach multiple files to a variant
- scope files per channel
- use built-in file types: uploaded files and external URLs
- configure download limits and availability windows
- send download links automatically after payment
- let customers download files from the storefront order area
- resend download emails from the admin panel
- upload large files in chunks
For uploaded files, the plugin copies the original product file into an order-specific storage when payment is completed. This keeps customer downloads independent from later catalog changes.
Requirements
- PHP 8.2+
- Symfony 6.4 or 7.4
- Sylius 2.x
- League Flysystem Bundle 3.x
- Node.js 20+ for building Sylius Standard frontend assets
Installation
1. Require the plugin
2. Register the bundle
Add the plugin bundle to config/bundles.php if it is not registered automatically:
3. Import the plugin routes
4. Extend your Sylius models
The plugin expects your application models to implement its interfaces and use its traits.
Product variant
Your product variant model should:
- implement
Jkindly\SyliusDigitalProductPlugin\Entity\DigitalProductVariantInterface - use
Jkindly\SyliusDigitalProductPlugin\Entity\Trait\DigitalProductFilesAwareTrait - use
Jkindly\SyliusDigitalProductPlugin\Entity\Trait\DigitalProductVariantSettingsAwareTrait - add the matching Doctrine relations for:
DigitalProductVariantSettingsDigitalProductFile
Example:
Channel
Your channel model should:
- implement
Jkindly\SyliusDigitalProductPlugin\Entity\DigitalProductChannelInterface - use
Jkindly\SyliusDigitalProductPlugin\Entity\Trait\DigitalProductFileChannelSettingsAwareTrait - add the relation for
DigitalProductChannelSettings
Order
Your order model should:
- implement
Jkindly\SyliusDigitalProductPlugin\Entity\DigitalProductOrderInterface - use
Jkindly\SyliusDigitalProductPlugin\Entity\Trait\DigitalProductOrderAwareTrait
Order item
Your order item model should:
- implement
Jkindly\SyliusDigitalProductPlugin\Entity\DigitalProductOrderItemInterface - use
Jkindly\SyliusDigitalProductPlugin\Entity\Trait\DigitalProductFilesAwareTrait - add the relation for
DigitalProductOrderItemFile
The test application in tests/TestApplication/src/Entity/ shows the full working setup.
5. Point Sylius resources to your extended models
Example:
6. Run migrations
The plugin prepends its Doctrine migrations automatically. Run:
7. Configure mailer, storage, and Twig hooks if needed
The bundle automatically registers:
- Sylius Mailer configuration for the digital download email
- Flysystem storages for product files, order files, and upload chunks
- Twig hooks for admin and shop UI integration
- serializer and validator mapping
You only need extra configuration if you want to override the defaults.
Configuration
Root key:
Available options:
Default storage directories:
var/uploads/product_filesvar/uploads/order_filesvar/uploads/tmp/chunks
Built-in File Types
The plugin provides two file types out of the box:
uploaded_file
A physical file stored through Flysystem.external_url
A redirect to a remote URL.
Each file type has its own:
- DTO
- form type
- validator
- serializer
- provider
- response generator
How It Works
Admin side
- channel forms expose default digital-product settings
- product and variant forms expose digital settings and file collections
- uploaded files can be sent directly or through chunked upload
- admins can download uploaded files for preview
Payment flow
When the workflow.sylius_order_payment.completed.pay event is triggered, the plugin:
- creates
DigitalProductOrderItemFilerecords for every digital file in the order - copies uploaded files into order-specific storage
- calculates download limits and expiration dates
- dispatches a message that sends the digital download email
Shop side
Customers receive download links after payment and can also access files from the order view.
The public download route uses a UUID token:
Before returning the response, the plugin:
- checks whether the file exists for the order
- verifies the download limit
- verifies the availability window
- increments the download count
- returns either a streamed file download or a redirect, depending on file type
Guest customers are supported because the UUID acts as the download token.
Operational Notes
Resend download email
The admin order page includes an action for resending the digital download email after the order has been paid.
Cleanup abandoned chunks
Large uploads can leave temporary chunk directories behind. Use:
Options:
--hours=24to remove only old chunks--forceto remove all chunk directories
Extending the Plugin
The file type system is extensible. To add a custom type, create and register:
- a DTO implementing
FileDtoInterface - a form type extending
AbstractFileType - a data transformer for DTO <-> array conversion
- a serializer for the configuration payload
- a response generator
- a provider implementing
FileProviderInterface
Register the provider, serializer, and response generator with the plugin tags defined in config/services/.
Development
Test application setup
Tests
For JavaScript Behat scenarios, start a browser driver and the Symfony test server first, as in the test application workflow already used in this repository.
License
This plugin is released under the MIT License.
All versions of sylius-digital-product-plugin with dependencies
league/flysystem-bundle Version ^3.6
sylius/sylius Version ^2.0.7
symfony/serializer Version ^6.4 || ^7.4
symfony/yaml Version ^6.4 || ^7.4