PHPackages                             monsieurbiz/sylius-plus-adapter-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. monsieurbiz/sylius-plus-adapter-plugin

ActiveSylius-plugin[Authentication &amp; Authorization](/categories/authentication)

monsieurbiz/sylius-plus-adapter-plugin
======================================

This plugin offer tools to adapt your plugins to Sylius Plus RBAC system.

v1.2.0(1y ago)034.0k↓20.5%4MITPHPPHP ^8.1CI passing

Since Mar 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/monsieurbiz/SyliusPlusAdapterPlugin)[ Packagist](https://packagist.org/packages/monsieurbiz/sylius-plus-adapter-plugin)[ RSS](/packages/monsieurbiz-sylius-plus-adapter-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (5)Used By (0)

Sylius Plus Adapter Plugin
==========================

[](#sylius-plus-adapter-plugin)

[![Menu Plugin license](https://camo.githubusercontent.com/bd4af86b46dcc0da4537b1885c8678039f62fce1ddea9f95373519380fc04d41/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6f6e736965757262697a2f53796c697573506c757341646170746572506c7567696e3f7075626c6963)](https://github.com/monsieurbiz/SyliusPlusAdapterPlugin/blob/master/LICENSE.txt)[![Tests Status](https://camo.githubusercontent.com/370a106612e68d2a47073d0ff31f04c6c646f1bb9a8d85b83d10e9d8b4d1c02e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6e736965757262697a2f53796c697573506c757341646170746572506c7567696e2f74657374732e79616d6c3f6272616e63683d6d6173746572266c6f676f3d676974687562)](https://github.com/monsieurbiz/SyliusPlusAdapterPlugin/actions?query=workflow%3ATests)[![Recipe Status](https://camo.githubusercontent.com/793be2f8d75cd6093767479c365f44edb15321c20ebb87995f3b307b4a4101d3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6e736965757262697a2f53796c697573506c757341646170746572506c7567696e2f7265636970652e79616d6c3f6272616e63683d6d6173746572266c6162656c3d72656369706573266c6f676f3d676974687562)](https://github.com/monsieurbiz/SyliusPlusAdapterPlugin/actions?query=workflow%3ASecurity)[![Security Status](https://camo.githubusercontent.com/9822969eaa4b8f6fee1850f2e98731993456f3887aefbe69d2240c3905cd512c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6e736965757262697a2f53796c697573506c757341646170746572506c7567696e2f73656375726974792e79616d6c3f6272616e63683d6d6173746572266c6162656c3d7365637572697479266c6f676f3d676974687562)](https://github.com/monsieurbiz/SyliusPlusAdapterPlugin/actions?query=workflow%3ASecurity)

This plugin offer tools to adapt your plugins to Sylius Plus RBAC system.

Compatibility
-------------

[](#compatibility)

Sylius VersionPHP Version1.128.1 - 8.2 - 8.31.138.1 - 8.2 - 8.31.148.1 - 8.2 - 8.3Installation
------------

[](#installation)

```
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
```

```
composer require monsieurbiz/sylius-plus-adapter-plugin
```

How to use
----------

[](#how-to-use)

To illustrate the following examples, we will use a `Foo` plugin with a `MyResource` resource.

***Your resource entity***

```
namespace Foo\SyliusBarPlugin\Entity;

use Sylius\Component\Channel\Model\ChannelsAwareInterface;
use Sylius\Component\Resource\Model\ResourceInterface;

class MyResource implements ResourceInterface, ChannelsAwareInterface
{
    // ...
}
```

***Your resource config***

```
sylius_resource:
    resources:
        foo_bar.my_resource:
            classes:
                model: Foo\SyliusBarPlugin\Entity\MyResource
```

### Add permissions on routes

[](#add-permissions-on-routes)

It's a Sylius native feature, you don't have to install this plugin!
You just have to add `permission: true` on your route definition.
If you do this, your route will become available on the permission tree.

#### Example

[](#example)

```
foo_bar_my_resource_admin:
    resource: |
        alias: foo_bar.my_resource
        section: admin
        permission: true
        templates: "@SyliusAdmin\\Crud"
        redirect: update
        grid: foo_bar_my_resource
    type: sylius.resource
```

### Add channel restriction on resources

[](#add-channel-restriction-on-resources)

If you want to add channel restrictions on your channel related resources, you have to following theses 2 steps:

- Your resource (entity) need to implement `\Sylius\Component\Channel\Model\ChannelAwareInterface` or `\Sylius\Component\Channel\Model\ChannelsAwareInterface`.
- You need to include the `\MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait` trait in your bundle extension class and call the `prependRestrictedResources` method in the `prepend` method.

#### Example

[](#example-1)

***Your plugin extension file***

```
namespace Foo\SyliusBarPlugin\DependencyInjection;

use MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;

class FooSyliusBarPluginExtension extends Extension implements PrependExtensionInterface
{
    use SyliusPlusCompatibilityTrait;

    public function prepend(ContainerBuilder $container): void
    {
        $this->prependRestrictedResources($container, ['my_resource']);
    }
}
```

### Filter resource grid with channel restriction

[](#filter-resource-grid-with-channel-restriction)

To filter the resource grid with channel restriction, you need to include the `\MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait`trait in your bundle extension class and call the `replaceInGridOriginalQueryBuilderWithChannelRestrictedQueryBuilder` method in the `prepend` method.
The goal of this is to replace the original query builder of the grid with a new one that call the original one but will filter the resources with the current channel if needed.

Configuring this is tricky so follow the example below.

#### Example

[](#example-2)

***Your current resource grid config***

```
sylius_grid:
    grids:
      foo_bar_my_resource:
            driver:
                name: doctrine/orm
                options:
                    class: '%foo.model.my_resource.class%'
                    repository:
                        method: createListQueryBuilder
                        arguments: ["%locale%"]
            # ...
```

***Your plugin extension file***

```
namespace Foo\SyliusBarPlugin\DependencyInjection;

use MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;

class FooSyliusBarPluginExtension extends Extension implements PrependExtensionInterface
{
    use SyliusPlusCompatibilityTrait;

    public function prepend(ContainerBuilder $container): void
    {
        $this->replaceInGridOriginalQueryBuilderWithChannelRestrictedQueryBuilder(
            $container,
            'foo_bar_my_resource', // This is the grid name
            '%foo_bar.model.my_resource.class%', // This is the resource class as in your original grid
            "expr:service('foo_bar.repository.my_resource').createListQueryBuilder('%locale%')" // This is the original query builder but called as an expression
        );
    }
}
```

### Filter channel choice type with channel restriction

[](#filter-channel-choice-type-with-channel-restriction)

To filter the channel choice type with channel restriction, you need to include the `\MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait` and call the `enabledFilteredChannelChoiceType` method in the `load` method.

#### Example

[](#example-3)

***Your current resource form type***

```
namespace Foo\SyliusBarPlugin\Form\Type;

use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;

class MyResourceType extends AbstractResourceType
{
    /**
     * @inheritdoc
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('channels', ChannelChoiceType::class, [
                'label' => 'fo_bar_my_resource.ui.form.channels',
                'required' => false,
                'multiple' => true,
                'expanded' => true,
            ])
            // ...
        ;
    }
```

***Your plugin extension file***

```
namespace Foo\SyliusBarPlugin\DependencyInjection;

use Foo\SyliusBarPlugin\Form\Type\MyResourceType;
use MonsieurBiz\SyliusPlusAdapterPlugin\DependencyInjection\SyliusPlusCompatibilityTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;

class FooSyliusBarPluginExtension extends Extension implements PrependExtensionInterface
{
    use SyliusPlusCompatibilityTrait;

    public function load(array $config, ContainerBuilder $container): void
    {
        // Loading your plugin configuration ...
        $this->enabledFilteredChannelChoiceType($container, ['my_resource' => MyResourceType::class]);
    }
}
```

Development
-----------

[](#development)

Because this plugin is a kind of sidekick for your plugins, it's not intended to be used in a standalone project.
Even more because it requires Sylius Plus to be useful. Our traditional test application then seems useless.

But to be fair, we still added a test app with our CMS plugin installed and configured to use the `SyliusPlusCompatibilityTrait` trait.
It would be useful to be sure that everything is working as expected in a normal Sylius even if this plugin is installed and used.

License
-------

[](#license)

This plugin is under the MIT license. Please see the [LICENSE](LICENSE) file for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance42

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% 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

Every ~101 days

Total

4

Last Release

482d ago

PHP version history (3 changes)v1.0.0PHP ~7.4|~8.0

v1.1.0PHP ^8.0

v1.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3505f6ef263882c7be77a72e76e675c69c9af9184bcd6469a87786a0c75e87a8?d=identicon)[lanfisis](/maintainers/lanfisis)

---

Top Contributors

[![maximehuran](https://avatars.githubusercontent.com/u/11380627?v=4)](https://github.com/maximehuran "maximehuran (8 commits)")[![lanfisis](https://avatars.githubusercontent.com/u/872996?v=4)](https://github.com/lanfisis "lanfisis (3 commits)")[![jacquesbh](https://avatars.githubusercontent.com/u/858611?v=4)](https://github.com/jacquesbh "jacquesbh (1 commits)")[![Kiwikoti](https://avatars.githubusercontent.com/u/111362284?v=4)](https://github.com/Kiwikoti "Kiwikoti (1 commits)")

---

Tags

sylius-pluginsyliussylius-pluginmonsieurbiz

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/monsieurbiz-sylius-plus-adapter-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/monsieurbiz-sylius-plus-adapter-plugin/health.svg)](https://phpackages.com/packages/monsieurbiz-sylius-plus-adapter-plugin)
```

###  Alternatives

[monsieurbiz/sylius-rich-editor-plugin

A Rich Editor plugin for Sylius.

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

A search plugin using Elasticsearch for Sylius.

49121.5k](/packages/monsieurbiz-sylius-search-plugin)[monsieurbiz/sylius-cms-page-plugin

This plugins allows you to add manage CMS pages using the Rich Editor

43117.2k1](/packages/monsieurbiz-sylius-cms-page-plugin)[monsieurbiz/sylius-settings-plugin

Add a settings panel to your Sylius.

27192.5k8](/packages/monsieurbiz-sylius-settings-plugin)[monsieurbiz/sylius-media-manager-plugin

Add a media manager to your Sylius.

1672.3k5](/packages/monsieurbiz-sylius-media-manager-plugin)[monsieurbiz/sylius-menu-plugin

This plugins allows you to manage menus.

1570.2k1](/packages/monsieurbiz-sylius-menu-plugin)

PHPackages © 2026

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