New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

laravie/authen

User Authentication Identifiers for Laravel
60,546 64

Larablocks Analysis

laravie/authen works with Laravel 8, 9 and 10 (latest release v3.1.0, Feb 8, 2023), all past end of life (the last on Feb 4, 2025): no more fixes, even for security.

Laravel 5, 6 and 7 in earlier releases.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 8, 9 and 10, past end of life since Feb 4, 2025
  • No release in the last 12 months (last: Feb 8, 2023)
  • 500 downloads a month (needs 10,000)
  • 64 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Feb 8, 2023.
  • No releases in the last 12 months.
  • First released: Nov 23, 2016.
  • Monthly downloads: 500, up 843% from six months ago.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require laravie/authen
Latest Version:v3.1.0
PHP:^7.3 || ^8.0
Laravel:8 · 9 · 10
Older releases:5 · 6 · 7
License:MIT
Last Updated:Oct 15, 2023
Links: GitHub  ·  Packagist
Maintainer: crynobone

User Authentication Identifiers for Laravel

tests Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Imagine you need to login a user with either "email", "username" or "phone number" just like how Facebook allows it. This is not possible with Laravel since you're limited to only one unique username/identifier key. This package attempt to solve the issue by allowing to use a unified key "identifier" and you can customize which attributes Laravel should check during authentication.

Installation

To install through composer, run the following command from terminal:

composer require "laravie/authen"

Usages

Service Provider

First you can attach the auth provider on App\Providers\AuthServiceProvider:

<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Laravie\Authen\BootAuthenProvider;

class AuthServiceProvider extends ServiceProvider
{
    use BootAuthenProvider;

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        $this->bootAuthenProvider();
    }
}

User Model

Secondly, you need to update the related App\User (or the eloquent model mapped for auth).

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravie\Authen\AuthenUser;

class User extends Authenticatable
{
    use Notifiable, AuthenUser;

    /**
     * Get the name of the unique identifier for the user.
     *
     * @return array<int, string>
     */
    public function getAuthIdentifiersName()
    {
        return ['email', 'username', 'phone_number'];
    }
}

With this setup, you can now check either email, username or phone_number during authentication.

Configuration

Lastly, you need to update the config config/auth.php:

<?php

return [

    // ...

    'providers' => [
        'users' => [
            'driver' => 'authen',
            'model'  => App\User::class,
        ],
    ],

    // ...
];

Examples

Here's an example how to login.

<?php 

use Illuminate\Support\Facades\Auth;
use Laravie\Authen\Authen;

$data = [Authen::getIdentifierName() => 'crynobone@gmail.com', 'password' => 'foobar'];

if (Auth::attempt($data)) {
    // you can logged in, you can also pass your phone number of username to `identifier`.
}

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
v3.1.0 ^7.3 || ^8.0 ^8.75 || ^9.45 || ^10.0 MIT
v3.0.2 ^7.3 || ^8.0 ^8.75 || ^9.45 MIT
v3.0.1 ^7.3 || ^8.0 ^8.67 || ^9.0 MIT
v3.0.0 ^7.3 || ^8.0 ^8.67 || ^9.0 MIT
v2.5.0 >=7.3 ^6.0 || ^7.0 || ^8.0 MIT
Pre-releases (1)
Version Released PHP Laravel License
v2.0.0-BETA1 >=7.0 ~5.5 MIT