Download the PHP package chientd/laravel5_multiauth without Composer

On this page you can find all versions of the php package chientd/laravel5_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 laravel5_multiauth

IMPORTANT: Laravel 5.1 and onward

Please head over to https://github.com/Kbwebs/MultiAuth as a replacement. kbwebs' fork is fully compatible with Laravel 5.1. Moving from my for to this should not need any changes in your code.

Laravel Multi Auth

For Laravel 4.2 version, see https://github.com/ollieread/multiauth


IMPORTANT: Laravel 5.1 Default AuthController with its traits

more specifically

does not work! For the time being, you need to write your own Controller for this. I will work on it if I have time.


This package is not a replacement for laravels default Auth library, but instead something that sits between your code and the library.

Think of it as a factory class for Auth. Now, instead of having a single table/model to authenticate users against, you can now have multiple, and unlike the previous version of this package, you have access to all functions, and can even use a different driver for each user type.

On top of that, you can use multiple authentication types, simultaneously, so you can be logged in as a user, a master account and an admin, without conflicts!

Custom Auth Drivers

At this current moment in time, custom Auth drivers written for the base Auth class will not work. I'm currently looking into this particular issue but for the meantime, you can work around this by changing your closure to return an instance of Ollieread\Multiauth\Guard instead of the default.

Installation

Firstly you want to include this package in your composer.json file.

Now you'll want to update or install via composer.

composer update

Next you open up app/config/app.php and replace the 'Illuminate\Auth\AuthServiceProvider', with

and 'Illuminate\Auth\Passwords\PasswordResetServiceProvider' with

NOTE It is very important that you replace the default service providers.

Remove the original database migration for password_resets.

Configuration

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

Now remove the first three options (driver, model and table) and replace as follows:

This is an example configuration. Note that you will have to create Models and migrations for each type of user. Use App\User.php and 2014_10_12_000000_create_users_table.php as an example.

If you wish to use a reminders email view per usertype, simply add an email option to the type, as shown in the above example.

To generate the reminders table you will need to run the following command.

php artisan multiauth:resets-table

Likewise, if you want to clear all reminders, you have to run the following command.

php artisan multiauth:clear-resets

You will also need to change the existing default Laravel 5 files to accommodate multiple auth and password types. Do as described in this gist:

https://gist.github.com/sboo/10943f39429b001dd9d0

Usage

Everything is done the exact same way as the original library, the one exception being that all method calls are prefixed with the key (account or user in the above examples) as a method itself.

I found that have to call the user() method on a user type called user() looked messy, so I have added in a nice get method to wrap around it.

In the instance where you have a user type that can impersonate another user type, example being an admin impersonating a user to recreate or check something, I added in an impersonate() method which simply wraps loginUsingId() on the request user type.

The first argument is the user type, the second is the id of said user, and the third is whether or not to remember the user, which will default to false, so can be left out more often than not.

And so on and so forth.

There we go, done! Enjoy yourselves.

Testing

Laravel integration/controller testing implements $this->be($user) to the base TestCase class. The implementation of #be() does not work correctly with Multiauth. To get around this, implement your own version of #be() as follows:

License

This package inherits the licensing of its parent framework, Laravel, and as such is open-sourced software licensed under the MIT license


All versions of laravel5_multiauth with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/auth Version ~5.0|~5.1
illuminate/console Version ~5.0|~5.1
illuminate/database Version ~5.0|~5.1
illuminate/filesystem Version ~5.0|~5.1
illuminate/support Version ~5.0|~5.1
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 chientd/laravel5_multiauth contains the following files

Loading the files please wait ....