Sylius Media Alt Text: Installation
Installing the Sylius Media Alt Text plugin via Composer (Packeton): register the bundle, import the admin route, create the tables with the setup command, plus update and uninstallation.
Sylius Media Alt Text: Installation
This documentation always describes the latest published version.
Installation
Composer (Packeton)
Private repositories are managed through Packeton (
https://packeton.markus-michalski.net). You receive credentials after purchasing a license or once access has been granted.
Add Packeton as a repository in composer.json:
{ "repositories": [{ "type": "composer", "url": "https://packeton.markus-michalski.net" }] }
composer require mmd/sylius-media-alt-text-plugin
Then, in this order:
-
Register the bundle in
config/bundles.php:Mmd\SyliusMediaAltTextPlugin\MmdSyliusMediaAltTextPlugin::class => ['all' => true], -
Import the admin route in
config/routes/mmd_sylius_media_alt_text.yaml:mmd_sylius_media_alt_text_admin: resource: "@MmdSyliusMediaAltTextPlugin/config/routes/admin.yaml" -
Create the tables:
bin/console mmd:media-alt-text:setup
The plugin ships no assets of its own, so assets:install is not needed. The bundle registers the Doctrine mapping, migrations, API Platform mapping, Twig hooks, template overrides and the form theme itself.
The setup command
mmd:media-alt-text:setup replaces doctrine:migrations:migrate. It has no options and does the following:
- runs only the pending migrations of this plugin, nothing from the app or from other plugins
- is idempotent: without a new migration nothing happens, so it is safe to run after every
composer update - checks whether the route from step 2 is imported and otherwise prints the ready-made YAML snippet (it never writes to
config/) - aborts if the plugin has migrations to run but Sylius's own migrations are still pending, with a hint to run
doctrine:migrations:migratefirst - inherits the interactivity of the call: the Doctrine confirmation prompt appears before running, and in scripts you pass
--no-interaction
Without the route import from step 2, the menu entry is missing in the admin. The sidebar does not break; the entry is simply left out.
Update
composer update mmd/sylius-media-alt-text-plugin
bin/console mmd:media-alt-text:setup
bin/console cache:clear
Uninstallation
The order matters: the migrations must be rolled back while the bundle is still registered:
-
Remove your own templates that call
mmd_image_alt(otherwise rendering fails without the plugin, see Storefront) -
Roll back the migrations, newest first:
bin/console doctrine:migrations:execute --down 'Mmd\SyliusMediaAltTextPlugin\Migrations\Version20261025110000' bin/console doctrine:migrations:execute --down 'Mmd\SyliusMediaAltTextPlugin\Migrations\Version20261025100000' -
Remove the route import and the bundle entry
-
composer remove mmd/sylius-media-alt-text-plugin
Rolling back deletes all maintained alt texts and the setting. Back up the tables first if you want to keep the texts.