PHPackages                             puz/multicolumnauth - 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. puz/multicolumnauth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

puz/multicolumnauth
===================

Makes it possible to log in with both a username and / or email

v0.1.0(10y ago)113PHP

Since Jan 29Pushed 10y ago2 watchersCompare

[ Source](https://github.com/molteber/puz-multicolumnauth)[ Packagist](https://packagist.org/packages/puz/multicolumnauth)[ RSS](/packages/puz-multicolumnauth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Laravel MultiColumnAuth
=======================

[](#laravel-multicolumnauth)

Ever felt like you need to allow both a `username` and `email` field? Then you're in luck!
Puz MultiColumnAuth enables you to allow your users to use whatever userfield they want to when they log in!

Installation
============

[](#installation)

```
composer require puz/multicolumnauth

```

You will need to update your `config/app.php` by adding the service provider to your application.
Add this under the provider section: `Puz\MultiColumnAuth\ServiceProvider::class`

To configure your fields and columns you'll need to add my configuration files. Simply do this by running the artisan command `php artisan vendor:publish`

The last thing you have to do now, is to replace the current Authorization trait. In the default AuthController class, you will see that laravel have included `use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;`. If you're still using both the authentication and registration of users, simply change this to: `use Puz\MultiColumnAuth\AuthenticatesAndRegistersUsers;`. If you don't need registration, simply change it to `use Puz\MultiColumnAuth\AuthenticatesUsers;`, or do the same if you have a custom registration trait maybe and need to include this `AuthenticatesUsers` in your custom class. In short, there are two available trais:
`Puz\MultiColumnAuth\AuthenticatesAndRegistersUsers`
`Puz\MultiColumnAuth\AuthenticatesUsers`

How to
======

[](#how-to)

**Select which columns I can use for login**
In your newly created config file from `php artisan vendor:publish` located in `config/puz/multicolumnauth.php`, there exists a array with a key named `columns`. This key takes an array as a value with the columns you want the users to log in with. Ex: `['username', 'email']` will check for the `username` column and then `email`.

**Select name of login field**
In the same config file, you have a key `loginfield`. This is set to `login` as default. This means that the input field where you usually inputs a username or email, you use the name `login`, or to something you freely choose yourself.

How does it work?
=================

[](#how-does-it-work)

If you have specified columns to log in with, if will loop through each one and try to log in. If it succeeds by one of then (first one to succeed), then it will log in with that.

**There is a catch tho..** If you for an example have set the `columns` to allow `username`, `phone` and `email`, in that specific order, then you have to be alert what the username might be. Someone can have created a username as someone else email. If they by any chance have the same password, someone will have access to another account.

As a fallback if you want to use laravel's default, you can simply change the columns in the config to a null value, like this

```
[
    'columns' => null,
]

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

3753d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2660f1a490c9540df6cf129e8dd1be0704c28192e91970776ec4734642a8fba?d=identicon)[Molteber](/maintainers/Molteber)

---

Top Contributors

[![molteber](https://avatars.githubusercontent.com/u/8125386?v=4)](https://github.com/molteber "molteber (3 commits)")

---

Tags

laravelauthauthorisationfieldmultifieldsauthenticatemultiplecolumncolumns

### Embed Badge

![Health badge](/badges/puz-multicolumnauth/health.svg)

```
[![Health](https://phpackages.com/badges/puz-multicolumnauth/health.svg)](https://phpackages.com/packages/puz-multicolumnauth)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M344](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M52](/packages/php-open-source-saver-jwt-auth)[ollieread/multiauth

Alternative auth system for Laravel

443135.6k1](/packages/ollieread-multiauth)[bmatovu/multi-auth

Laravel Multi Authentication

18325.1k](/packages/bmatovu-multi-auth)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5030.7k](/packages/sarav-laravel-multiauth)[awes-io/auth

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

3826.7k1](/packages/awes-io-auth)

PHPackages © 2026

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