PHPackages                             jmikola/auto-login-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. jmikola/auto-login-bundle

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

jmikola/auto-login-bundle
=========================

Authenticate users in your Symfony app via a single query parameter (e.g. email and newsletter links).

2.0.1(6y ago)84323.6k↓19.2%16[3 issues](https://github.com/jmikola/JmikolaAutoLoginBundle/issues)[2 PRs](https://github.com/jmikola/JmikolaAutoLoginBundle/pulls)MITPHPPHP &gt;=7.1

Since Feb 26Pushed 2y ago7 watchersCompare

[ Source](https://github.com/jmikola/JmikolaAutoLoginBundle)[ Packagist](https://packagist.org/packages/jmikola/auto-login-bundle)[ Docs](https://github.com/jmikola/JmikolaAutoLoginBundle)[ RSS](/packages/jmikola-auto-login-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (9)Versions (12)Used By (0)

JmikolaAutoLoginBundle
======================

[](#jmikolaautologinbundle)

This bundle integrates the [AutoLogin](https://github.com/jmikola/AutoLogin) library with Symfony, which implements a security firewall listener to authenticate users based on a single query parameter. This is useful for providing one-click login functionality in email and newsletter links.

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

[](#installation)

The bundle is published as a [package](https://packagist.org/packages/jmikola/auto-login-bundle) and is installable via [Composer](http://getcomposer.org/):

```
$ composer require jmikola/auto-login-bundle=^2.0

```

Activate the bundle in your application kernel:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Jmikola\AutoLoginBundle\JmikolaAutoLoginBundle(),
            // ...
        );
    }
}
```

### Compatibility

[](#compatibility)

This bundle requires Symfony 4.3 or above.

Usage and Configuration
-----------------------

[](#usage-and-configuration)

You need to create a new `UserProvider` service that implements `Jmikola\AutoLogin\User\AutoLoginUserProviderInterface`. This service is responsible for resolving the URL token to a user object.

This bundle registers a firewall listener, which is configured via the `jmikola_auto_login` key in your security component's firewall configuration. See this example configuration:

```
# services.yml
services:
  acme.auto_login_user_provider:
    # Implements Jmikola\AutoLogin\User\AutoLoginUserProviderInterface
    class: Acme\UserBundle\Security\AcmeAutoLoginUserProvider
```

```
# security.yml
security:
  firewalls:
    main:
      # We need not specify a "provider" for our firewall or listeners,
      # since SecurityBundle will default to the first provider defined.
      jmikola_auto_login:
        auto_login_user_provider: acme.auto_login_user_provider
```

In the example above, we specify a custom service for `auto_login_user_provider`since the default `EntityUserProvider` does not implement `AutoLoginUserProviderInterface`.

When visiting `http://example.com/path?_al=foobar`, `AcmeAutoLoginUserProvider::loadUserByAutoLoginToken()` will be invoked with the value "foobar". This method should resolve that value to a user object or throw a `Jmikola\AutoLogin\Exception\AutoLoginTokenNotFoundException`.

### Listener Options

[](#listener-options)

The AutoLoginFactory defines the following listener options:

- `auto_login_user_provider`: AutoLoginUserProviderInterface service, which provides a method to load users by an auto-login token (i.e. query parameter). If this service is not defined, the listener's user provider will be used by default and an exception will be thrown if the provider does not implement the required interface (in addition to UserProviderInterface).
- `provider`: User provider key. This is a standard option for most security listeners. If undefined, the default user provider for the firewall is used (see: [SecurityBundle documentation](http://symfony.com/doc/current/book/security.html#using-multiple-user-providers)).
- `token_param`: The query parameter to be checked for an auto-login token. The presence of this query parameter will determine if the auto-login listener attempts authentication. In that respect, it is similar to the `check_path` option for the form-login listener. If undefined, the option defaults to `_al`.
- `override_already_authenticated`: Boolean option determines whether an auto-login token should override an existing, authenticated session. This option defaults to false.

### Alternative Configuration Example

[](#alternative-configuration-example)

In this example, we specify a provider that implements both `Symfony\Component\Security\Core\User\UserProviderInterface` and `Jmikola\AutoLogin\User\AutoLoginUserProviderInterface`. We also customize the URL parameter to use "auto\_login" instead of the default "\_al":

```
# services.yml
services:
  acme.versatile_user_provider:
    # This class implements UserProviderInterface and
    # AutoLoginUserProviderInterface
    class: Acme\UserBundle\Security\VersatileUserProvider
```

```
# security.yml
security:
  providers:
    acme_user_provider:
      id: acme.versatile_user_provider
  firewalls:
    main:
      jmikola_auto_login:
        token_param: auto_login
        # We need not configure the auto_login_user_provider option here, as the
        # bundle will default to the firewall's default user provider, which
        # implements the necessary interface.
```

### FOSUserBundle Configuration Example

[](#fosuserbundle-configuration-example)

If you are using [FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle), defining a service ID for your user provider will look familiar. You can easily integrate this bundle with FOSUserBundle by defining a custom service for `fos_user.user_manager`:

```
services:
    acme.user_manager:
        # This class extends the appropriate UserManager from FOSUserBundle
        # and implements Jmikola\AutoLogin\User\AutoLoginUserProviderInterface
        class: Acme\UserBundle\Model\UserManager
        # Note: the remaining service configuration is abridged

fos_user:
    service:
        user_manager: acme.user_manager
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78% 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 ~259 days

Recently: every ~345 days

Total

11

Last Release

2237d ago

Major Versions

v1.1.4 → 2.0.02020-04-02

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

2.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/49096f4052ca788ddf49c82e835125294f460f155885aa3e1ada8c3ff4f4a648?d=identicon)[jmikola](/maintainers/jmikola)

---

Top Contributors

[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (32 commits)")[![fran6co](https://avatars.githubusercontent.com/u/726088?v=4)](https://github.com/fran6co "fran6co (3 commits)")[![henrikbjorn](https://avatars.githubusercontent.com/u/19725?v=4)](https://github.com/henrikbjorn "henrikbjorn (2 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (2 commits)")[![SvetlinStaev](https://avatars.githubusercontent.com/u/8427480?v=4)](https://github.com/SvetlinStaev "SvetlinStaev (1 commits)")[![SvetlinStaevWorldstores](https://avatars.githubusercontent.com/u/17498708?v=4)](https://github.com/SvetlinStaevWorldstores "SvetlinStaevWorldstores (1 commits)")

---

Tags

securityAuthenticationloginauto-login

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jmikola-auto-login-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/jmikola-auto-login-bundle/health.svg)](https://phpackages.com/packages/jmikola-auto-login-bundle)
```

###  Alternatives

[scheb/2fa

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

578630.7k1](/packages/scheb-2fa)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[scheb/2fa-bundle

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

6914.0M62](/packages/scheb-2fa-bundle)[jmikola/auto-login

Facilitates automatic login via a single token for Symfony's Security component.

100307.6k2](/packages/jmikola-auto-login)[delight-im/auth

Authentication for PHP. Simple, lightweight and secure.

1.3k135.7k20](/packages/delight-im-auth)[auth0/symfony

Symfony SDK for Auth0 Authentication and Management APIs.

128738.1k](/packages/auth0-symfony)

PHPackages © 2026

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