PHPackages                             restricted/authchain - 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. [Database &amp; ORM](/categories/database)
4. /
5. restricted/authchain

ActiveLibrary[Database &amp; ORM](/categories/database)

restricted/authchain
====================

Laravel 4 chain authentication (LDAP, IMAP, IP, Eloquent)

1.0.8(11y ago)51005[1 issues](https://github.com/restricted/authchain/issues)MITPHPPHP &gt;=5.3.0

Since Dec 6Pushed 10y agoCompare

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

READMEChangelogDependencies (1)Versions (10)Used By (0)

Laravel 4 chain authentication provider
=======================================

[](#laravel-4-chain-authentication-provider)

**WARNING: Project no longer maintaned!**

Supports native database, LDAP, IMAP and IP address multi-domain authentication for single sign-on.

For LDAP and IMAP authentication you need to have `ldap` and `imap` php extensions.

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

[](#installation)

Installing this package through Composer. Edit your project's `composer.json` file to require `restricted/authchain`.

```
"require": {
	"laravel/framework": "4.2.*",
	"restricted/authchain": ">=1.0.6"
}

```

Update Composer from the Terminal:

```
composer update

```

Once this operation completes, the next step is to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.

```
'providers' => [
    // Your Laravel providers here...
    'Restricted\Authchain\AuthchainServiceProvider'
]
```

Create example configuration file from terminal:

```
php artisan config:publish restricted/authchain

```

**Change default authentication provider to `authchain`.**

Open `app/config/auth.php` and change `driver` section to `authchain`.

```
return array(

	'driver': 'authchain'

	// Related stuff...
);

```

Please see `app/config/packages/restricted/authchain/config.php` for full configuration instructions.

You need to create User model in `app/models` and create migration.

For details on models and migrations you can see `vendor/restricted/authchain/quickstart`

You can simply copy contents of folder `vendor/restricted/authchain/quickstart/models/` to `app/models`.

Example migration can be executed by command `php artisan migrate --package="restricted/authchain"`.

> NOTE: migration does`t include timestamps.

If you don't use ip address authentication, set `['defaults']['ip']` to `false` in `app/config/packages/restricted/authchain/config.php`.

Quickstart
----------

[](#quickstart)

Install laravel (see )

```
composer create-project laravel/laravel your-project-name --prefer-dist

```

Install authchain provider (see [Installation](#installation))

Configure your domains in `app/config/packages/restricted/authchain/config.php`

Copy files from

```
cp -r vendor/restricted/authchain/quickstart/models/* app/models
cp -r vendor/restricted/authchain/quickstart/controllers/* app/controllers/
cp -r vendor/restricted/authchain/quickstart/views/* app/views

```

Replace `auth` route filter in your file `app/filters.php` with contents from `vendor/restricted/authchain/quickstart/filters.php`

```
cat vendor/restricted/authchain/quickstart/filters.php >> app/filters.php

```

Add to your `app/routes.php` contents from `vendor/restricted/authchain/quickstart/routes.php`

```
cat vendor/restricted/authchain/quickstart/routes.php >> app/routes.php

```

Serve your application from terminal: `php artisan serve`

Go to `http://localhost:8000/` and enjoy!

Need community feedback
-----------------------

[](#need-community-feedback)

- Need to implement oAuth2 ?
- Other providers?

Contribute
----------

[](#contribute)

### Any suggestions are welcome

[](#any-suggestions-are-welcome)

You can easily write your own authentication provider for authchain:

Custom provider example (see in `src/Restricted/Authchain/Provider/Domain/CustomProviderExample`):

```
namespace Restricted\Authchain\Provider\Domain;

use Restricted\Authchain\Config\Loader;
use Restricted\Authchain\Provider\Provider;
use Restricted\Authchain\Provider\ProviderInterface;

class CustomProviderExample extends Provider implements ProviderInterface
{
    // Authentication logic
    // $this->username is username provided by user
    // $this->password is password from form

    // @return UserInterface|null

    public function authenticate()
    {
    	// Loading users from config for domain $this->domain

        $users = Loader::domain($this->domain)['users'];

	// If user not found in array, return null

        if (!isset($users[$this->username])) {
            return null;
        }

	// Grab user password from config

        $password = $users[$this->username];

	// Check password

        if (\Hash::check($this->password, $password)) {

            $newUser                       = $this->model();
            $newUser->{Loader::username()} = $this->username;
            $newUser->{Loader::password()} = \Hash::make($password);
            $newUser->enabled              = true;

            $newUser->save();

            return $newUser;
        }

        return null;
    }

    // Must return name of the provider, for example 'custom'
    // In app/config/packages/restricted/authchain/config.php
    // you can regiter new provider in 'providers' array and pass config variables to it

    public function provides()
    {
        return 'custom';
    }

}
```

Create config for custom provider in `app/config/packages/restricted/authchain/config.php`:

Register custom provider in section `providers`:

```
'providers' => array(
    // ...
    'Restricted\Authchain\Provider\Domain\CustomProviderExample',
)

```

In section `domains`:

```
'localhost' => array(
    'provider' => 'custom', // See method provides()
        'users' => array(
            'demo@localhost' => '$2y$10$/Ij0dzDL49OaODli.1GcveefSdEapt2vgb8shplVI7RIJadPmL6km' // Encrypted password
    )
)

```

Now, all users with domain `localhost` authenticates over custom provider and native provider (Eloquent).

- For questions, create issue with your question.
- For request features, create issue with detailed explanation of a feature.

License
-------

[](#license)

Distributed under the terms of the MIT license.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~52 days

Recently: every ~103 days

Total

9

Last Release

4170d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/694885?v=4)[Alexey Dementyev](/maintainers/restricted)[@restricted](https://github.com/restricted)

---

Top Contributors

[![restricted](https://avatars.githubusercontent.com/u/694885?v=4)](https://github.com/restricted "restricted (32 commits)")

---

Tags

laravelsecurityauthAuthenticationeloquentldapimap

### Embed Badge

![Health badge](/badges/restricted-authchain/health.svg)

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

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M91](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M42](/packages/kirschbaum-development-eloquent-power-joins)[kodeine/laravel-acl

Light-weight role-based permissions for Laravel 5 built in Auth system.

779358.1k5](/packages/kodeine-laravel-acl)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k322.4k1](/packages/cybercog-laravel-love)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.3M16](/packages/reedware-laravel-relation-joins)[sroutier/eloquent-ldap

A Laravel package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.

208.7k1](/packages/sroutier-eloquent-ldap)

PHPackages © 2026

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