PHPackages                             sylius/legacy-shop-bridge-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sylius/legacy-shop-bridge-plugin

ActiveSylius-plugin

sylius/legacy-shop-bridge-plugin
================================

Legacy Shop Bridge plugin for Sylius.

v0.1(3mo ago)2485↑256.7%1[2 PRs](https://github.com/Sylius/LegacyShopBridgePlugin/pulls)MITTwigPHP ^8.2CI passing

Since Jan 21Pushed 3mo agoCompare

[ Source](https://github.com/Sylius/LegacyShopBridgePlugin)[ Packagist](https://packagist.org/packages/sylius/legacy-shop-bridge-plugin)[ GitHub Sponsors](https://github.com/sylius)[ RSS](/packages/sylius-legacy-shop-bridge-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (32)Versions (3)Used By (0)

 [    ![Sylius Logo.](https://camo.githubusercontent.com/ea9dddc934264aa7ec01cf3202c500f3d8b04448bce2571bdc74230efddda88f/68747470733a2f2f6d656469612e73796c6975732e636f6d2f73796c6975732d6c6f676f2d3830302e706e67)  ](https://sylius.com)

Sylius Legacy Shop Bridge Plugin
================================

[](#sylius-legacy-shop-bridge-plugin)

A plugin for bridging legacy Sylius functionality with modern Sylius applications.

About
-----

[](#about)

This plugin enables Sylius 2.0 applications to use the legacy shop frontend from Sylius 1.x. It provides:

- **Legacy Template Events** - Restores the `sylius_template_event` Twig function and template block system from SyliusUiBundle 1.x
- **Shop Controllers** - Controllers for cart, orders, currency/locale switching, and other shop functionality removed in Sylius 2.0
- **Sonata Block Integration** - Support for Sonata blocks in templates
- **Twig Extensions** - Legacy Twig filters like `sort_by`

Installation
------------

[](#installation)

1. Install the plugin via Composer:

```
composer require sylius/legacy-shop-bridge-plugin --no-scripts
```

2. Enable the plugin and required bundles in `config/bundles.php`:

```
return [
    // ...
    Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
    FOS\RestBundle\FOSRestBundle::class => ['all' => true],
    Sylius\LegacyShopBridgePlugin\SyliusLegacyShopBridgePlugin::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

### 1. Import Plugin Configuration

[](#1-import-plugin-configuration)

Add the plugin configuration import to your `config/packages/_sylius.yaml` (or main configuration file):

```
imports:
    # ...
    - { resource: "@SyliusLegacyShopBridgePlugin/config/config.yaml" }
```

### 2. Configure FOSRestBundle

[](#2-configure-fosrestbundle)

If you don't have FOSRestBundle configured yet, add the following to `config/packages/fos_rest.yaml`:

```
fos_rest:
    exception: true
    view:
        formats:
            json: true
            xml:  true
        empty_content: 204
    format_listener:
        rules:
            - { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
            - { path: '^/', stop: true }
```

### 3. Configure Controllers

[](#3-configure-controllers)

Configure the Sylius controllers to use the legacy bridge functionality:

**Option A: If you have NOT overridden the following controllers in your project**

Add the following to your `config/packages/_sylius.yaml`:

```
sylius_order:
    resources:
        order:
            classes:
                controller: Sylius\LegacyShopBridgePlugin\Controller\OrderController
        order_item:
            classes:
                controller: Sylius\LegacyShopBridgePlugin\Controller\OrderItemController

sylius_addressing:
    resources:
        province:
            classes:
                controller: Sylius\LegacyShopBridgePlugin\Controller\ProvinceController
```

**Option B: If you HAVE already any of these controllers in your project**

Add the appropriate traits to your existing controllers:

```
// src/Controller/OrderController.php
namespace App\Controller;

use Sylius\LegacyShopBridgePlugin\Controller\Trait\OrderTrait;

class OrderController extends \Sylius\Bundle\CoreBundle\Controller\OrderController
{
    use OrderTrait; // Adds: widgetAction(), clearAction()

    // ... your existing custom methods
}
```

```
// src/Controller/OrderItemController.php
namespace App\Controller;

use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\LegacyShopBridgePlugin\Controller\Trait\OrderItemTrait;

class OrderItemController extends ResourceController
{
    use OrderItemTrait; // Adds: addAction(), removeAction() and helper methods

    // ... your existing custom methods
}
```

```
// src/Controller/ProvinceController.php
namespace App\Controller;

use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\LegacyShopBridgePlugin\Controller\Trait\ProvinceTrait;

class ProvinceController extends ResourceController
{
    use ProvinceTrait; // Adds: choiceOrTextFieldFormAction() and helper methods

    // ... your existing custom methods
}
```

### 4. Update UI Configuration

[](#4-update-ui-configuration)

Replace `sylius_ui` configuration with `sylius_legacy_shop_bridge` in your `config/packages/sylius_ui.yaml` (or wherever your UI events are configured):

```
# Before
sylius_ui:
    events:
        # ...

# After
sylius_legacy_shop_bridge:
    events:
        # ...
```

### 5. Configure Twig Paths

[](#5-configure-twig-paths)

Add the following Twig paths configuration to your `config/packages/twig.yaml`:

```
twig:
    paths:
        # Add the lines ONLY for overridden bundles' templates in your project
        '%kernel.project_dir%/templates/bundles/SyliusShopBundle': 'SyliusShop'
        '%kernel.project_dir%/templates/bundles/SyliusUiBundle': 'SyliusUi'

        # These two lines are REQUIRED
        '%kernel.project_dir%/vendor/sylius/legacy-shop-bridge-plugin/templates/bundles/SyliusShopBundle': 'SyliusShop'
        '%kernel.project_dir%/vendor/sylius/legacy-shop-bridge-plugin/templates/bundles/SyliusUiBundle': 'SyliusUi'
```

**Note:** The first lines are only needed if you have customized `SyliusShopBundle` or `SyliusUiBundle` templates in your `templates/bundles/` directory. The last two lines pointing to the plugin's templates are always required and have to be placed at the end.

### 6. Add Routes

[](#6-add-routes)

Add the plugin routes to your `config/routes.yaml` file. **Important:** These routes must be loaded after the shop routes:

```
# Your shop routes
sylius_shop:
    resource: "@SyliusShopBundle/Resources/config/routing.yml"
    prefix: /{_locale}
    requirements:
        _locale: ^[a-z]{2}(?:_[A-Z]{2})?$

# Legacy bridge routes - must be loaded AFTER shop routes
sylius_legacy_shop_bridge:
    resource: "@SyliusLegacyShopBridgePlugin/config/routes.yaml"
```

### 7. Update Encore Entry Points (Shop)

[](#7-update-encore-entry-points-shop)

Update your shop template base file to use legacy Encore entries:

```
{# Before #}
{{ encore_entry_link_tags('shop-entry', null, 'shop') }}
{{ encore_entry_script_tags('shop-entry', null, 'shop') }}

{# After #}
{{ encore_entry_link_tags('legacy-shop-entry', null, 'legacy.shop') }}
{{ encore_entry_script_tags('legacy-shop-entry', null, 'legacy.shop') }}
```

### 8. Update Asset Paths

[](#8-update-asset-paths)

Replace asset references to use the legacy paths:

```
{# Example 1 #}
{# Before: #}
{{ asset('build/shop/images/logo.png', 'shop') }}
{# After: #}
{{ asset('build/legacy/shop/images/logo.png', 'legacy.shop') }}

{# Example 2 #}
{# Before: #}
{{ asset('build/shop/images/sylius-plus-banner.png', 'shop') }}
{# After: #}
{{ asset('build/legacy/shop/images/sylius-plus-banner.png', 'legacy.shop') }}
```

**Regex for bulk replacement:**

Find:

```
(\{\{\s*asset\(\s*['"])build/shop/([^'"]+)(['"]\s*,\s*['"])shop(['"]\s*\)\s*\}\})
```

Replace:

```
$1build/legacy/shop/$2$3legacy.shop$4

```

**Note:** These regexes work within PHPStorm: Cmd+Shift+R (Find and Replace in Files), enable Regex, paste both patterns.

### 9. Configure Webpack

[](#9-configure-webpack)

Add the legacy bridge configuration to your `webpack.config.js`:

```
const path = require('path');

// ... your existing Encore configurations ...

// Legacy Shop Configuration
Encore.reset();

Encore
    .setOutputPath('public/build/legacy/shop')
    .setPublicPath('/build/legacy/shop')
    .addEntry('legacy-shop-entry', path.resolve(__dirname, './vendor/sylius/legacy-shop-bridge-plugin/assets/shop/entrypoint.js'))
    .addAliases({
        'semantic-ui-css': path.resolve(__dirname, 'node_modules/semantic-ui-css'),
        'jquery': path.resolve(__dirname, 'node_modules/jquery'),
        'lightbox2': path.resolve(__dirname, 'node_modules/lightbox2'),
        'slick-carousel': path.resolve(__dirname, 'node_modules/slick-carousel'),
    })
    .disableSingleRuntimeChunk()
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())
    .enableSassLoader()
;

const legacyShopConfig = Encore.getWebpackConfig();

legacyShopConfig.externals = Object.assign({}, legacyShopConfig.externals, { window: 'window', document: 'document' });
legacyShopConfig.name = 'legacy.shop';

// Export all configs
module.exports = [
    // ... your existing configs ...
    legacyShopConfig,
];
```

### 10. Install Frontend Dependencies

[](#10-install-frontend-dependencies)

Add the following legacy dependencies to your `package.json`:

```
{
    "dependencies": {
        "jquery": "^3.5.0",
        "lightbox2": "^2.9.0",
        "semantic-ui-css": "^2.2.0",
        "slick-carousel": "^1.8.1"
    }
}
```

Then install the dependencies:

```
npm install
# or
yarn install
```

### 11. Build Assets

[](#11-build-assets)

Build your frontend assets:

```
npm run build
# or
yarn build
```

### 12. Update Twig Templates

[](#12-update-twig-templates)

When migrating legacy templates, you need to update certain Twig function calls and menu names:

**Menu name changes:**

```
{# Before #}
{{ knp_menu_render('sylius.shop.account', ...) }}

{# After #}
{{ knp_menu_render('sylius_shop.account', ...) }}
```

**Twig function replacements:**

BeforeAfter`sylius_order_items_subtotal(order)``order.getItemsSubtotal()``sylius_order_tax_included(order)``order.getTaxIncludedTotal()``sylius_order_tax_excluded(order)``order.getTaxExcludedTotal()``sylius_product_variant_prices(product, sylius.channel)``sylius_product_variants_map(product, {'channel': sylius.channel})`Usage
-----

[](#usage)

Once installed and configured, the plugin will provide legacy compatibility for older Sylius templates and functionality, allowing you to gradually migrate to modern Sylius features.

License
-------

[](#license)

This plugin is under the MIT license. See the complete license in the LICENSE file.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance80

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 64.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

111d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/719423?v=4)[Sylius eCommerce](/maintainers/sylius)[@Sylius](https://github.com/Sylius)

![](https://www.gravatar.com/avatar/4b4a5a1a9293502aa8573551fab020963a9050c5cca4524433b6d94214d3b480?d=identicon)[GSadee](/maintainers/GSadee)

---

Top Contributors

[![Wojdylak](https://avatars.githubusercontent.com/u/33687392?v=4)](https://github.com/Wojdylak "Wojdylak (29 commits)")[![NoResponseMate](https://avatars.githubusercontent.com/u/9448101?v=4)](https://github.com/NoResponseMate "NoResponseMate (16 commits)")

---

Tags

syliussylius-pluginlegacy-shop-bridge

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sylius-legacy-shop-bridge-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/sylius-legacy-shop-bridge-plugin/health.svg)](https://phpackages.com/packages/sylius-legacy-shop-bridge-plugin)
```

###  Alternatives

[bitbag/cms-plugin

CMS plugin for Sylius applications.

2461.1M5](/packages/bitbag-cms-plugin)[sylius/paypal-plugin

PayPal plugin for Sylius.

451.4M4](/packages/sylius-paypal-plugin)[sylius/invoicing-plugin

Invoicing plugin for Sylius.

901.0M2](/packages/sylius-invoicing-plugin)[sylius/refund-plugin

Plugin provides basic refunds functionality for Sylius application.

691.7M14](/packages/sylius-refund-plugin)[stefandoorn/sitemap-plugin

Sitemap Plugin for Sylius

851.0M](/packages/stefandoorn-sitemap-plugin)[monsieurbiz/sylius-rich-editor-plugin

A Rich Editor plugin for Sylius.

75380.8k6](/packages/monsieurbiz-sylius-rich-editor-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
