Skip to main content

New Sylius Force Login Plugin Release

· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

Besides developing Sylius plugins for our partners like Gally or SCHUFA, we also have our own Sylius plugins in development.

The first plugin we ever released for Sylius is our Force Login plugin. The plugin is a port of our famous Magento plugin to the Sylius platform. This provided a great learning experience when we started to develop with Sylius.

What does the plugin do?

The plugin allows you to restrict which pages a visitor is able to see. Visitors get redirected to the Sylius login page if the page is not marked visitable. The plugin is especially useful for merchants serving only a specific group of users, e.g. enterprise related business partners and need to ensure that only those users are able to browse the website or the product catalog.

We've released version 0.3 of the plugin last week which makes the plugin compatible with Sylius 2.0.

How to install?

  1. Install the plugin via Composer
composer require bitexpert/sylius-force-login-plugin
  1. Enable the plugin
<?php
# config/bundles.php
return [
// ...

BitExpert\SyliusForceCustomerLoginPlugin\BitExpertSyliusForceCustomerLoginPlugin::class => ['all' => true],
];
  1. Import config
# config/packages/_sylius.yaml
imports:
# ...

- { resource: "@BitExpertSyliusForceCustomerLoginPlugin/Resources/config/config.yml" }

# ...
  1. Import routing
# config/routes/bitexpert_sylius_force_login.yaml
bitexpert_sylius_forcelogin:
resource: "@BitExpertSyliusForceCustomerLoginPlugin/Resources/config/admin_routing.yml"
prefix: '/%sylius_admin.path_name%'
  1. Update your database schema
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

If you like the plugin, let us know!