PHPackages                             kikwik/double-opt-in-bundle - 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. kikwik/double-opt-in-bundle

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

kikwik/double-opt-in-bundle
===========================

Double opt-in management for Doctrine 2 entities

v1.1.4(1mo ago)0464MITPHPPHP &gt;=7.1.3

Since Feb 6Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/kikwik/double-opt-in-bundle)[ Packagist](https://packagist.org/packages/kikwik/double-opt-in-bundle)[ RSS](/packages/kikwik-double-opt-in-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (20)Used By (0)

KikwikDoubleOptInBundle
=======================

[](#kikwikdoubleoptinbundle)

Double opt-in management for Doctrine 2 entities in symfony 4.4 and 5.x

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

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require kikwik/double-opt-in-bundle
```

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

[](#configuration)

Configure the symfony/mailer component in your `.env` file:

```
MAILER_DSN=sendmail+smtp://localhost
```

Import double opt in check routes in `config/routes.yaml`:

```
kikwik_double_opt_in_bundle:
  resource: '@KikwikDoubleOptInBundle/Resources/config/routes.xml'
  prefix: '/double-opt-in'
```

Create the `config/packages/kikwik_double_opt_in.yaml` config file, set the `sender_email` parameter

```
kikwik_double_opt_in:
    sender_email: '%env(SENDER_EMAIL)%'
    sender_name: '%env(SENDER_NAME)%'
    remove_secret_code_after_verification: true
```

and define it in your .env file

```
SENDER_EMAIL=no-reply@example.com
SENDER_NAME="My Company Name"
```

Implements `DoubleOptInInterface` to your classes or use the `DoubleOptInTrait`:

```
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Kikwik\DoubleOptInBundle\Model\DoubleOptInInterface;
use Kikwik\DoubleOptInBundle\Model\DoubleOptInTrait;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * @ORM\Entity(repositoryClass=UserRepository::class)
 * @ORM\Table(name="`user`")
 */
class User implements UserInterface, DoubleOptInInterface
{
    use DoubleOptInTrait;

    //...

    /**
     * return an array or a DTO object which will be used as context in the confirmation email.
     */
    public function getDoubleOptInEntityAsDto()
    {
        return [
            'email' => $this->getEmail(),
            'field1' => $this->getField1(),
            'field2' => $this->getField2(),
        ];
    }
}
```

Make migrations and update your database

```
$ php bin/console make:migration
$ php bin/console doctrine:migrations:migrate
```

Usage
-----

[](#usage)

Every time you persist a new entity which implements DoubleOptInInterface a confirmation email is sent. If you want to disable the confirmation email (useful when importing data) just call `disableDoubleOptIn` before persisting your entity

```
$user = new User();
$user->setEmail('test@example.com');
$user->setPassword('secret');

$user->disableDoubleOptIn();

$em->persist($user);
$em->flush();
```

To resend the confirmation email autowire the `DoubleOptInMailManager` service and call `sendEmail` (be sure that `$doubleOptInSecretCode` field is not empty)

```
/**
 * @Route("/resend-email/{id}", name="app_resend_email")
 */
public function resendConfirmationEmail(User $user, DoubleOptInMailManager $doubleOptInMailManager)
{
    if($user->getDoubleOptInSecretCode())
    {
        $doubleOptInMailManager->sendEmail($user);
    }
    return $this->redirectToRoute('app_home');
}
```

Customization
-------------

[](#customization)

Copy translations file from `vendor/kikwik/double-opt-in-bundle/src/Resources/translations/KikwikDoubleOptInBundle.xx.yaml`to `translations/KikwikDoubleOptInBundle.xx.yaml` and make changes here.

```
double_opt_in:
    title: Verifica email
    success: La tua email è stata verificata con successo
    danger: Il codice di verifica non è stato trovato, forse è già stato usato?
    email:
        subject: 'Conferma la tua email'
        content: |

                Clicca qui per confermare la tua email
                oppure incolla in seguente link nella barra degli indirizzi del browser: {{ confirm_url }}

```

EventListener
-------------

[](#eventlistener)

After a successful double-opt-in confirmation the bundle will dispatch the `DoubleOptInVerifiedEvent` custom event, so you can listen for it and do your stuff.

```
// src/EventSubscriber/AfterDoubleOptInEventSubscriber.php
namespace App\EventSubscriber;

use Kikwik\DoubleOptInBundle\Event\DoubleOptInVerifiedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AfterDoubleOptInEventSubscriber implements EventSubscriberInterface
{
    public function onDoubleOptInVerified(DoubleOptInVerifiedEvent $event)
    {
        $object = $event->getObject();

        // Do something with the $object, which is verified

        // You may set the response to redirect to a custom page:
        // $event->setResponse(new RedirectResponse('http://example.com/success'));
    }

    public static function getSubscribedEvents()
    {
        return [
            'kikwik.double_opt_in.verified' => 'onDoubleOptInVerified',
        ];
    }
}
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~104 days

Recently: every ~265 days

Total

19

Last Release

49d ago

Major Versions

v0.0.4 → v1.0.02021-02-23

PHP version history (2 changes)v0.0.1PHP ^7.1.3

v1.1.4PHP &gt;=7.1.3

### Community

Maintainers

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

---

Top Contributors

[![kikwik](https://avatars.githubusercontent.com/u/58590255?v=4)](https://github.com/kikwik "kikwik (32 commits)")

### Embed Badge

![Health badge](/badges/kikwik-double-opt-in-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/kikwik-double-opt-in-bundle/health.svg)](https://phpackages.com/packages/kikwik-double-opt-in-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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