2017 © Pedro Peláez
 

library laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

image

longman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  • Thursday, August 17, 2017
  • by LONGMAN
  • Repository
  • 1 Watchers
  • 6 Stars
  • 88 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 14 % Grown

The README.md

Laravel 5.x dummy user provider

Build Status Code Quality Latest Stable Version Total Downloads Downloads Month License, (*1)

Dummy (without database) user authorization for Laravel 5.x, (*2)

Table of Contents

Installation

Install this package through Composer., (*3)

Edit your project's composer.json file to require longman/laravel-dummyuser, (*4)

Create composer.json file:, (*5)

{
    "name": "yourproject/yourproject",
    "type": "project",
    "require": {
        "longman/laravel-dummyuser": "~1.0"
    }
}

And run composer update, (*6)

Or run a command in your command line:, (*7)

composer require longman/laravel-dummyuser

After updating composer, add the DummyUserServiceProvider to the providers array in config/app.php, (*8)

Longman\LaravelDummyUser\DummyUserServiceProvider::class,

In the config/auth.php file you should add dummy guard in the guards array:, (*9)

'guards' => [
    . . .

    'dummy' => [
        'driver' => 'session',
        'provider' => 'dummy',
    ],
]

and provider in the providers array, (*10)

'providers' => [
    . . .

    'dummy' => [
        'driver' => 'dummy',
        'lifetime' => 3600, // Cache lifetime in minutes
    ],
]

Usage

You can specify default guard dummy in the config/auth.php file (defaults array) and use just Auth:: calls, or use Auth::guard('dummy'), like Auth::guard('dummy')->login($user), (*11)

For authenticating users, you need some unique identifier. You can use remote id or something like md5('some-unique-mail@mail.com'), (*12)

In User model you need to add id in fillable array. And if you use string id also add protected $keyType = 'string'; field., (*13)

Usage example:, (*14)

<?php
// get some user data from Restful service
$user_data = get_user_data_from_service();
$email = $user_data['email'];

$user = new User(['id' => md5($email), 'name' => $user_data['name'], ...]);

// Log in user
Auth::login($user);

TODO

write tests, (*15)

Troubleshooting

If you like living on the edge, please report any bugs you find on the laravel-dummyuser issues page., (*16)

Contributing

Pull requests are welcome. See CONTRIBUTING.md for information., (*17)

License

Please see the LICENSE included in this repository for a full copy of the MIT license, which this project is licensed under., (*18)

Credits

The Versions

17/08 2017

dev-master

9999999-dev https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless

17/08 2017

1.0.10

1.0.10.0 https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless

17/08 2017

1.0.9

1.0.9.0 https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless

17/08 2017

1.0.8

1.0.8.0 https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless

17/08 2017

1.0.7

1.0.7.0 https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless

17/08 2017

1.0.6

1.0.6.0 https://github.com/akalongman/laravel-dummyuser

Package to implement dummy user authorization (without database) for Laravel 5.x

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel user auth dbless