PHPackages                             duro85/ajaxauth - 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. duro85/ajaxauth

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

duro85/ajaxauth
===============

a package to allow full ajax authentication for Laravel 5.3

0.0.7(9y ago)063BSD-3-ClausePHPPHP &gt;=5.6.4

Since Feb 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/duro85/ajaxauth)[ Packagist](https://packagist.org/packages/duro85/ajaxauth)[ Docs](https://github.com/duro85/ajaxauth)[ RSS](/packages/duro85-ajaxauth/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

AjaxAuth (Laravel &gt;=5.3 Package)
===================================

[](#ajaxauth-laravel-53-package)

[![StyleCI](https://camo.githubusercontent.com/3615d22e75711e9bcbb35c68b22e7264bc1d4530bfdcd5a03b9714860978098c/68747470733a2f2f7374796c6563692e696f2f7265706f732f37333832373235322f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/73827252)

AjaxAuth it's a simple package that provides a fully configurable authorization/registration flow via ajax. It provides its controllers and publishes its configuration and its routes, which can then be changed at will.

Contents
--------

[](#contents)

- [Installation](#installation)
- [License](#license)
- [Contribution guidelines](#contribution-guidelines)

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

[](#installation)

1. In order to install AjaxAuth, just add the following to your composer.json. Then run `composer update`:

```
"Duro85/AjaxAuth": "0.*"
```

2. Open your `config/app.php` and add the following to the `providers` array:

```
Duro85\AjaxAuth\AjaxAuthServiceProvider::class,
Duro85\AjaxAuth\AjaxAuthRouteServiceProvider::class,
```

3. execute command :

```
php artisan vendor:publish

```

this will publish routes, configurations and language files.

4. edit your model : in order to get a fully configurable Notification for the retrieve password email you have to insert this code into each Authenticatable model :

```
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new AjaxAuthNotification($token, 'guard_name', ['name' => $this->name]));
    }

```

this method overrides the standard one and lets you manage EASILY your email notification. AjaxAuthNotification acepts three params : a $tocken (don't bother at it, it'll be provided by the framework ), a guard name ( to retrieve the right configuration ), and an optional array of params to be passed to an email view to personalize the message (cool huh ?). How this works ? Really simply, let's have a look to the code :

```
public function toMail($notifiable)
    {
        // get password config
        $config = config("auth.passwords.{$this->guard}");
        if (isset($config['view'])) {
            /*
             * custom view message
             */
            return (new MailMessage)->view($config['view'], $this->mail_params);
        } else {
            /**
             * standard laravel notification email with localizable test
             */
            //you can specify a different route for each guard
            $link = isset($config['route']) ? route($config['route'], $this->token) : route('password.reset', $this->token);
            return (new MailMessage)->view()
                            ->line('You are receiving this email because we received a password reset request for your account.')
                            ->action('Reset Password', $link)
                            ->line('If you did not request a password reset, no further action is required.');
        }
    }

```

As you can see, the behaviour of this custom Notification it's influenced by the password config. array, to be more precise you can choose to set, in the config array, a 'view' key to specify a full custom email template or a 'route' key to use the standard email notification template but with a specific ( for the guard ) link, so you no longer have to have a single link to the password reset form, each guard will have its link ! Let me give you a couple of example :

```
// file : config/auth.php
'passwords' => [
    'foo' => [
        'provider' => 'provider_foo',
        'view'    => 'auth.emails.passwords_foo',
        'table'    => 'password_resets_foo',
        'expire'   => 240,
    ],
    'bar' => [
        'provider' => 'provider_bar',
        'route'    => 'bar.reset.password',
        'table'    => 'password_resets_bar',
        'expire'   => 240,
    ],
],

```

5. configure your validators : this package will publish a ajaxauth.php into your config/ folder, this configuration file will store your guard' validators, let's have :

```
return [
    'validators' => [
        'foo' => [
            'register'    => [
                'firstname'   => 'required|max:255',
                'lastname'   => 'required|max:255',
                'email'       => 'required|email|max:255|unique:foo_table',
                'password'    => 'required|min:6',
            ],
            'login'       => [
                'email' => 'required|email|max:255',
                'password'  => 'required|min:6|confirmed',
            ],
            'passwordnew' => [
                'token'    => 'required',
                'email'    => 'required|email',
                'password' => 'required|confirmed|min:6',
            ],
        ],
        'bar' => [
            'register'    => [
                'tax_code'   => 'required|max:255',
                'email'       => 'required|email|max:255|unique:bar_table',
                'password'    => 'required|min:6',
            ],
            'login'       => [
                'tax_code' => 'required|min:255',
                'password'  => 'required|min:6|confirmed',
            ],
            'passwordnew' => [
                'token'    => 'required',
                'email'    => 'required|email',
                'password' => 'required|confirmed|min:6',
            ],
        ],
    ],
];

```

6. that's it ! Of course you still need to build forms and controllers to display them, but now you can let them work in AJAX !! ( such form, very ajax, much laravel ! )

License
-------

[](#license)

AjaxAuth is free software distributed under the terms of the BSD-3-Clause license. Please refer to [license](LICENSE).

Contribution guidelines
-----------------------

[](#contribution-guidelines)

Support follows PSR-1 and PSR-4 PHP coding standards, and semantic versioning.

Please report any issue you find in the issues page.
Pull requests are welcome.

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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

Every ~3 days

Total

7

Last Release

3440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c2c8436deea523315a999832e0609f6766ad670372dbd43d2e41384223521dd?d=identicon)[Duro85](/maintainers/Duro85)

---

Top Contributors

[![duro85](https://avatars.githubusercontent.com/u/2648992?v=4)](https://github.com/duro85 "duro85 (27 commits)")

---

Tags

laravelauthajax

### Embed Badge

![Health badge](/badges/duro85-ajaxauth/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k19.4M70](/packages/lab404-laravel-impersonate)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21327.3k4](/packages/ecotone-laravel)[lakm/nopass

Provides passwordless authentication for your laravel projects.

2216.7k3](/packages/lakm-nopass)[hapidjus/laravel-impersonate-ui

UI for 404labfr/laravel-impersonate

371.6k](/packages/hapidjus-laravel-impersonate-ui)

PHPackages © 2026

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