This bundle requires Symfony >= 2.6 (3.x.x and 4.x.x).
The off-the-shelf version of the bundle is compatible with standard user/password authentication. If your system is not using this, you will have to configure a security token class for your authentication methods.
If you're using anything other than Doctrine ORM to manage the User Entity you will have to implement a persister service.
If you're using Symfony 4, you must install templating package:
php composer.phar require templating
and configure it with your favorite engine:
framework:
templating:
engines: twig
Add this bundle via Composer:
php composer.phar require scheb/two-factor-bundle
When being asked for the version, use the latest stable release or any different version you want.
Alternatively you can also add the bundle directly to composer.json:
{
"require": {
"scheb/two-factor-bundle": "~1.0"
}
}
and then tell Composer to install the bundle:
php composer.phar update scheb/two-factor-bundle
Enable this bundle in your app/AppKernel.php
:
public function registerBundles()
{
$bundles = array(
// ...
new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
);
}
If you're using Symfony >= 4 you have to edit config/bundles.php
:
return [
// ...
Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
];
Next you'll want probably want to configure the bundle.
For more specific configuration information, see Google Authenticator or Email.