PHPackages                             vivanwebsolution/sylius-2fa-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. vivanwebsolution/sylius-2fa-plugin

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

vivanwebsolution/sylius-2fa-plugin
==================================

VivanWebSolution Sylius 2FA Plugin

v1.1.0(11mo ago)06773[2 PRs](https://github.com/vivanwebsolution/sylius-2fa-plugin/pulls)proprietaryPHPPHP ^8.2CI failing

Since May 29Pushed 3mo agoCompare

[ Source](https://github.com/vivanwebsolution/sylius-2fa-plugin)[ Packagist](https://packagist.org/packages/vivanwebsolution/sylius-2fa-plugin)[ RSS](/packages/vivanwebsolution-sylius-2fa-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (34)Versions (5)Used By (0)

Sylius 2FA Google Authenticator Plugin
======================================

[](#sylius-2fa-google-authenticator-plugin)

This plugin enables **Google Two-Factor Authentication (2FA)** for Sylius 2.0 Admin Users using:

- [`scheb/2fa-bundle`](https://github.com/scheb/2fa-bundle)
- [`scheb/2fa-google-authenticator`](https://github.com/scheb/2fa-google-authenticator)

It allows admins to secure their accounts with Google Authenticator time-based one-time passwords (TOTP).

---

Features
--------

[](#features)

- Seamless integration of Google Authenticator for 2FA on Sylius Admin Users
- Admin UI toggle to enable/disable 2FA per user
- AJAX-enabled toggle with CSRF protection
- Extends the Sylius `AdminUser` entity to support `TwoFactorInterface`
- QR code generation for quick mobile setup using [`endroid/qr-code`](https://github.com/endroid/qr-code)

---

Requirements
------------

[](#requirements)

- Sylius 2.0
- PHP 8.x
- Composer

---

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require vivanwebsolution/sylius-2fa-plugin
```

### 2. Enable the Bundle

[](#2-enable-the-bundle)

In config/bundles.php, register the bundle:

```
return [
   // ...
   Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
];
```

### 3. Configure the Bundle

[](#3-configure-the-bundle)

Create the config file at config/packages/scheb\_2fa.yaml:

```
scheb_two_factor:
   security_tokens:
       - Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken
       - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken
   google:
       enabled: true
       server_name: 'Sylius Admin'
```

To clear the Symfony cache, run:

```
php bin/console cache:clear
```

### 4. Extend the AdminUser Entity

[](#4-extend-the-adminuser-entity)

Modify your AdminUser entity to implement the 2FA interface:

```
