loevgaard / sylius-brand-plugin
A Sylius plugin for handling brands
Fund package maintenance!
Setono
Installs: 150 586
Dependents: 2
Suggesters: 1
Security: 0
Stars: 30
Watchers: 3
Forks: 30
Open Issues: 15
Type:sylius-plugin
pkg:composer/loevgaard/sylius-brand-plugin
Requires
- php: >=8.2
- doctrine/collections: ^2.0
- doctrine/orm: ^3.0
- knplabs/knp-menu: ^3.8
- sylius/core: ^2.0
- sylius/core-bundle: ^2.0
- sylius/product-bundle: ^2.0
- sylius/resource-bundle: ^1.13
- sylius/ui-bundle: ^2.0
- symfony/config: ^6.4 || ^7.4
- symfony/dependency-injection: ^6.4 || ^7.4
- symfony/event-dispatcher: ^6.4 || ^7.4
- symfony/form: ^6.4 || ^7.4
- symfony/http-foundation: ^6.4 || ^7.4
- symfony/options-resolver: ^6.4 || ^7.4
- symfony/ux-autocomplete: ^2.31
- symfony/ux-live-component: ^2.31
- webmozart/assert: ^1.12
Requires (Dev)
- payum/core: ^1.7.6
- setono/sylius-plugin-pack: ~2.1.0
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/maker-bundle: ^1.65
- symfony/property-info: ^6.4 || ^7.4
- symfony/serializer: ^6.4 || ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.4
- 3.x-dev
- v3.0.0-alpha.2
- v3.0.0-alpha
- 2.x-dev
- v2.2.1
- v2.2.0
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-beta.6
- v2.0.0-beta.5
- v2.0.0-beta.4
- v2.0.0-beta.3
- v2.0.0-beta.2
- v2.0.0-beta
- dev-master / 1.3.x-dev
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- dev-l10n_master
- dev-php8
- dev-example-extend-entities
This package is auto-updated.
Last update: 2025-12-04 13:24:30 UTC
README
Add brand to your products in Sylius.
Requirements
- PHP 8.2+
- Sylius 2.0+
- Symfony 6.4 or 7.4
Installation
Step 1: Download the plugin
composer require loevgaard/sylius-brand-plugin
Step 2: Enable the plugin
Enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php file of your project before (!) SyliusGridBundle:
<?php # config/bundles.php return [ // ... Loevgaard\SyliusBrandPlugin\LoevgaardSyliusBrandPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
Step 3: Configure routing
# config/routes/loevgaard_sylius_brand.yaml loevgaard_sylius_brand: resource: "@LoevgaardSyliusBrandPlugin/config/routes.yaml"
Step 4: Extend Product entity
Extend your Product entity to implement BrandAwareInterface:
<?php // src/Entity/Product/Product.php declare(strict_types=1); namespace App\Entity\Product; use Doctrine\ORM\Mapping as ORM; use Loevgaard\SyliusBrandPlugin\Model\BrandAwareInterface; use Loevgaard\SyliusBrandPlugin\Model\BrandAwareTrait; use Sylius\Component\Core\Model\Product as BaseProduct; #[ORM\Entity] #[ORM\Table(name: 'sylius_product')] class Product extends BaseProduct implements BrandAwareInterface { use BrandAwareTrait; }
The
BrandAwareTraitalready includes the Doctrine ORM mapping attributes, so you don't need to add any additional mapping configuration.
Step 5: Configure Sylius resource
# config/packages/sylius_product.yaml sylius_product: resources: product: classes: model: App\Entity\Product\Product
The above configuration is most likely already done in your application.
Step 6: Update your database schema
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
Optional Configuration
Show Brand column in admin products list
# config/packages/loevgaard_sylius_brand.yaml imports: - { resource: "@LoevgaardSyliusBrandPlugin/config/grids/sylius_admin_product.yaml" }
Fixtures
Include predefined brand fixtures to play with on your dev environment:
# config/packages/loevgaard_sylius_brand.yaml imports: - { resource: "@LoevgaardSyliusBrandPlugin/config/fixtures.yaml" }
Or write your own:
# config/packages/my_fixtures.yaml sylius_fixtures: suites: my_brand_fixtures: fixtures: loevgaard_sylius_brand_plugin_brand: options: custom: my_brand: name: 'My brand' code: 'my-brand' images: - type: logo path: images/my-brand/logo.jpg products: - product_code_1 - product_code_2
Load your fixtures:
php bin/console sylius:fixture:load my_brand_fixtures
Development
Customization
Twig Hooks
The plugin uses Sylius Twig Hooks for customization. Available hook points:
Product form:
sylius_admin.product.create.content.form.sections.general(priority 250)sylius_admin.product.update.content.form.sections.general(priority 250)
Brand form:
loevgaard_sylius_brand.brand.create.contentloevgaard_sylius_brand.brand.update.contentloevgaard_sylius_brand.brand.create.content.form.form_sections.generalloevgaard_sylius_brand.brand.update.content.form.form_sections.generalloevgaard_sylius_brand.brand.create.content.form.form_sections.medialoevgaard_sylius_brand.brand.update.content.form.form_sections.media
Translations
Currently supported languages:
- English (en)
- German (de)
- French (fr)
- Spanish (es)
- Italian (it)
- Dutch (nl)
- Polish (pl)
- Danish (da)
- Swedish (sv)
- Norwegian (no)
- Finnish (fi)