Download the PHP package wuifdesign/multiauth without Composer

On this page you can find all versions of the php package wuifdesign/multiauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package multiauth

Laravel MultiAuth

GitHub release Packagist License

Twitter

Laravel: 5.0, 5.1

This Package extends the default Auth library to allow logging in with accounts from different database tables or even different databases. For example if you want to save your backend and a frontend users in a different table to keep them separated.

Works with the default Laravel 5 AuthController and PasswordController!

Installation

The easiest way is to run the following command:

composer require wuifdesign/laravel-multiauth

Otherwise you can include the package in your composer.json file,

"require": {
    "wuifdesign/laravel-multiauth": "0.3.*"
}

and update or install via composer:

composer update

Now you have to open up your app/config/app.php and add

'providers' => [
    ...
    WuifDesign\MultiAuth\ServiceProvider::class
]

Configuration is pretty easy too, take app/config/auth.php with its default values

return array(

    'driver' => 'eloquent',
    'model' => 'User',
    'table' => 'users',

    'password' => array(
        'email' => 'emails.password',
        'table' => 'password_reminders',
        'expire' => 60,
    ),

);

and replace the first three options (driver, model, table) and replace them with the following

return array(

    'default' => 'user',
    'multi' => array(
        'admin' => array(
            'driver' => 'eloquent',
            'model'  => Admins::class,
        ),
        'user' => array(
            'driver' => 'eloquent',
            'model'  => Users::class,
            'password' => [
                'email' => 'users.emails.password',
            ]
        )
    ),

    'password' => array(
        'email' => 'emails.password',
        'table' => 'password_reminders',
        'expire' => 60,
    ),
);

Usage

Everything is done by using routes. Just add a key "auth" to the route array with the value you used as a key in your app/config/auth.php

Route::get('/', array(
    'uses' => function () {
        return 'Hello World';
    },
    'middleware' => [ 'auth' ],
    'auth' => 'admin',
));

Now if you call Auth::check() or any other function, it will use the driver and model set in the config for the key "admin".

If you don't add a "auth" to the route, the "default" type defined in the app/config/auth.php will be used.

If you want to check a specific auth while in a route using a different auth, you can use Auth::type($auth_key) to get the wanted auth manager.

Auth::type('admin')->check();

To get the current auth_key used by the route, or the default value, if you haven't set it in the route use.

Auth::currentType();

If you want to login as a different user, just use Auth::impersonate($id, $auth_key = null, $remember = false). If you don't parse a auth_key, the key set via route, or the default one will be used.

Auth::impersonate(3, 'admin');

All versions of multiauth with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 5.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wuifdesign/multiauth contains the following files

Loading the files please wait ....