skyyware / mail-template-sync
Synchronize Shopware mail templates with the filesystem.
Package info
github.com/skyyware/mail-template-sync
Type:shopware-platform-plugin
pkg:composer/skyyware/mail-template-sync
Requires
- php: >=8.2
- shopware/core: ~6.7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.68
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Mail Template Sync keeps Shopware mail templates in portable, reviewable files. It supports Shopware 6.7 on PHP 8.2 or newer.
Compatibility
New releases support the current stable Shopware major line only, currently
6.7. Version 0.2.x requires Shopware 6.7. Version 0.1.1 remains available
for Shopware 6.6, but receives no further fixes. Existing tags are never changed.
Installation
Install with Composer:
composer require skyyware/mail-template-sync:^0.2 bin/console plugin:refresh bin/console plugin:install --activate SkyyMailTemplateSync
You can also install the packaged ZIP through the Shopware extension manager, or place the
plugin in custom/plugins/SkyyMailTemplateSync. Then refresh, install, and
activate it with the normal Shopware plugin lifecycle.
Commands
Export one template by technical name:
bin/console skyy:mail-template:export order_confirmation_mail
Export every template:
bin/console skyy:mail-template:export --all
Preview an import without backups or database writes:
bin/console skyy:mail-template:import --all --dry-run
Import one template, or confirm an interactive bulk import:
bin/console skyy:mail-template:import order_confirmation_mail bin/console skyy:mail-template:import --all
Automation must explicitly acknowledge bulk writes:
bin/console skyy:mail-template:import --all --no-interaction --force
Use --directory=/absolute/path or a path relative to the Shopware project to
override the default custom/mail-templates directory. Plugin configuration
must be project-relative. Existing path ancestors and symbolic links are
canonicalized before use; the project root, its vendor tree, this plugin's
package root, and relative symlink escapes are rejected.
The plugin settings provide the default storage directory
(SkyyMailTemplateSync.config.storageDirectory) and backup retention in days
(SkyyMailTemplateSync.config.backupRetentionDays, default 365).
Command output contains only counts, technical names, and changed field paths.
Template subjects and bodies are never printed. Imports validate all selected
files and targets before writing; changed templates are backed up under
var/skyy-mail-template-sync/backups and updated in individual transactions.
Each import transaction uses one parameterized DBAL SELECT ... FOR UPDATE on
the system-default mail_template row solely to coordinate concurrent writes.
All entity reads, translation reads, and entity writes remain Shopware DAL
operations.
Portable Format
Each system-default template uses this portable layout:
<technical-name>/
manifest.json
<locale>/
subject.twig
sender-name.twig
description.txt
html.twig
plain.twig
The deterministic manifest contains exactly schema version 1, the technical
name, the system-default marker, sorted locales, and a nullFields map; extra
top-level metadata is rejected. All five files are always present. A null field
has an empty file and is named explicitly in nullFields, preserving the
difference between null and an intentional empty string. Manifests contain no
Shopware entity or language IDs.
Export is authoritative and removes stale locale directories. Import is merge-oriented and leaves Shopware-only locales intact. Bulk import rejects missing, empty, or malformed roots instead of silently processing zero bundles.
Uninstall
Uninstalling without --keep-user-data removes the plugin settings. With this
option, Shopware retains the settings. Exported templates and backups remain
on disk in either case.
Development
Install dependencies and run every local quality gate:
composer install bin/check
bin/check validates Composer metadata, runs unit tests, PHPStan, the style
check, Git whitespace checks, and package verification. bin/package creates
build/SkyyMailTemplateSync-0.2.1.zip with a single
SkyyMailTemplateSync/ root and no development-only files.
Run the real Shopware container and DAL transaction tests against an isolated
database. The Shopware test bootstrap appends _test to the database name:
DATABASE_URL='mysql://root@127.0.0.1:3306/skyy_mail_sync' \ SHOPWARE_PROJECT_ROOT='/path/to/shopware' \ bin/integration
The runner temporarily exposes this checkout at
custom/plugins/SkyyMailTemplateSync, refuses unrelated occupied targets, and
removes only a symlink it created.
Release checks run locally against the current stable Shopware 6.7 release on PHP 8.2 and 8.4. GitHub Actions is disabled.
See CONTRIBUTING.md for the fork-and-pull-request workflow and SECURITY.md for private vulnerability reporting.
License
MIT. See LICENSE.