PHPackages                             rockz/email-auth-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. rockz/email-auth-bundle

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

rockz/email-auth-bundle
=======================

Authenticate the user by sending an authorization request to his email.

v1.0.0(7y ago)29MITPHPPHP ^7.1

Since Jun 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Scribblerockerz/email-auth-bundle)[ Packagist](https://packagist.org/packages/rockz/email-auth-bundle)[ RSS](/packages/rockz-email-auth-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

The EmailAuthBundle
===================

[](#the-emailauthbundle)

This bundle provides a way to authenticate a registered user by email only. A magic link is send to the user where this request can be accepted or rejected.

[![build status](https://camo.githubusercontent.com/fa72941c08307f8b4c31659cfddf47a5a88a070122af09b8d5c1aae623b7002e/68747470733a2f2f7472617669732d63692e6f72672f5363726962626c65726f636b65727a2f656d61696c2d617574682d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Scribblerockerz/email-auth-bundle)

**Attention:** This bundle is currently not ready for production!

This bundle supports symfony 4 only.

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

[](#installation)

### 1. Download the Bundle

[](#1-download-the-bundle)

```
composer require rockz/email-auth-bundle

```

### 2. Configuration

[](#2-configuration)

Configure the firewall by adding the `rockz_email_auth` key to it. Provide a user provider which should be used for the authentication procedure.

```
# /config/packages/security.yaml
security:
  firewalls:
    main:
      rockz_email_auth: ~
```

Import bundle specific routes.

```
# /config/routes/rockz_email_auth.yaml
_some_routing_key:
  resource: "@RockzEmailAuthBundle/Resources/config/routes.xml"
```

### 3. Prepare your template

[](#3-prepare-your-template)

Insert this minimum form somewhere on your page.

```

```

The request must be a post, with the provided `email_auth` parameter containing the users email.

### 4. Update your database

[](#4-update-your-database)

Generate migration or update your database schema right away:

```
# Quick update
bin/console doctrine:schema:update --force # don't do this in production

# or generate migrations
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
```

### 5. Configure your SwiftMailer

[](#5-configure-your-swiftmailer)

This bundle uses the SwiftMailer to send emails to the user which is provided by the configured user provider.

Documentation: [SwiftMailer configuration](https://symfony.com/doc/current/reference/configuration/swiftmailer.html)

### 6. CSRF Protection (optional)

[](#6-csrf-protection-optional)

You can enable csrf protection for your login form.

Enable the `csrf_protection` under your firewall settings for `rockz_email_auth`.

```
# /config/packages/security.yaml
security:
  firewalls:
    main:
      rockz_email_auth:
        csrf_protection: true
```

Add the following part to your login form:

```

```

If you haven't required `symfony/form` you may do this by running

```
composer require symfony/form

```

It contains twig's `csrf_token` helper method.

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

[](#configuration)

Most of the bundle behaviour is configured inside the firewall configuration in the security section.

```
# /config/packages/security.yaml
security:
    firewalls:
        main:
            rockz_email_auth:

                # Required to remember an authentication between requests
                remember_me:          true

                # Service id of handlers
                pre_auth_success_handler: ~
                pre_auth_failure_handler: ~
                success_handler:      ~
                failure_handler:      ~

                # input field parameter from the form/request
                email_parameter:      email_auth

                # redirect the user to this path/route if the user hits a restricted area
                initial_redirect:     /access

                # redirect the user to this path/route after an authorization request is sent
                pre_auth_success_redirect: /waiting

                # redirect the user to this path/route after an authorization request was rejected by the system
                pre_auth_failure_redirect: '/#partial_failure'

                # redirect the user to this path/route after an authorization request was accepted by the user
                success_redirect:     /

                # redirect the user to this path/route after an authorization request was rejected by the system or the user
                failure_redirect:     '/#total_failure'

                # bundle's core service for remote authorizations
                remote_authorization:
                    authorize_route:      rockz_email_auth_authorization_authorize
                    refuse_route:         rockz_email_auth_authorization_refuse
                    from_email:           changeme@example.com
                    template_email_authorize_login: '@RockzEmailAuth/emails/authorization/login.html.twig'

                # optional csrf protection, requires symfony/form package
                csrf_protection:      false
                csrf_token_id:        rockz_email_auth_authenticate
                csrf_parameter:       _csrf_token
```

Example Setup
-------------

[](#example-setup)

TBD.

The following part should explain how this bundle is supposed to be used.

```
# /config/packages/security.yaml
security:
    providers:
        in_memory_members:
            memory:
                users:
                    john@example.com:
                        roles: ROLE_USER
                    emely@example.com:
                        roles: ROLE_USER
    firewalls:
        # custom firewall for the email authentication
        premium_firewall:
            # your user provider goes here (can be anything that provides a user)
            provider: in_memory_members

            # actual bundle specific configuration
            rockz_email_auth:
                remote_authorization:
                    from_email: "john.fox@example.com"

            # support logout
            logout:
                path:   /logout
                target: /

            # allow anonymous users to reach any routes
            anonymous: ~
        #...
    access_control:
        - { path: ^/premium, roles: ROLE_USER }
        - { path: ^/account, roles: ROLE_USER }
```

Import routes for the authorization controller. Create that file (btw. you can name it how ever you want).

```
# /config/routes/rockz_email_auth.yaml
_some_routing_key:
  resource: "@RockzEmailAuthBundle/Resources/config/routes.xml"

# previously configured logout action needs this path
logout:
    path: /logout
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Unknown

Total

1

Last Release

2902d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09e01efbf2c5601aa925f3c8cd44d39995eca672eea6714882abfa8d61236c40?d=identicon)[Scribblerockerz](/maintainers/Scribblerockerz)

---

Top Contributors

[![Scribblerockerz](https://avatars.githubusercontent.com/u/1336156?v=4)](https://github.com/Scribblerockerz "Scribblerockerz (36 commits)")

---

Tags

phpsymfonysymfony-bundle

### Embed Badge

![Health badge](/badges/rockz-email-auth-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/rockz-email-auth-bundle/health.svg)](https://phpackages.com/packages/rockz-email-auth-bundle)
```

###  Alternatives

[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[scheb/2fa-bundle

A generic interface to implement two-factor authentication in Symfony applications

6914.0M62](/packages/scheb-2fa-bundle)[klapaudius/oauth-server-bundle

Symfony(5.x to 8.x) OAuth Server Bundle

15547.3k2](/packages/klapaudius-oauth-server-bundle)[sulu/skeleton

Project template for starting your new project based on the Sulu content management system

29733.3k](/packages/sulu-skeleton)[pumukit/pumukit

Media Portal

5714.0k37](/packages/pumukit-pumukit)

PHPackages © 2026

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