PHPackages                             longman/laravel-dummyuser - 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. longman/laravel-dummyuser

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

longman/laravel-dummyuser
=========================

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

1.0.10(8y ago)63.4kMITPHPPHP &gt;=5.5.9

Since Aug 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/akalongman/laravel-dummyuser)[ Packagist](https://packagist.org/packages/longman/laravel-dummyuser)[ Docs](https://github.com/akalongman/laravel-dummyuser)[ RSS](/packages/longman-laravel-dummyuser/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (7)Versions (12)Used By (0)

Laravel 5.x dummy user provider
===============================

[](#laravel-5x-dummy-user-provider)

[![Build Status](https://camo.githubusercontent.com/69aab9a263e9caf62b4f34c7e03feec87e576ba77dc7a3beed676867ee87495d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616b616c6f6e676d616e2f6c61726176656c2d64756d6d79757365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/akalongman/laravel-dummyuser)[![Code Quality](https://camo.githubusercontent.com/a440080b87a0ea5e3af428515d52980b0e0c3e9d6a6be18fba242691ea83117f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616b616c6f6e676d616e2f6c61726176656c2d64756d6d79757365722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/akalongman/laravel-dummyuser/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/9f271a2c7d41b7043612058e553c80475427bb764e7605fc8835a042201cba58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f616b616c6f6e676d616e2f6c61726176656c2d64756d6d79757365722e7376673f7374796c653d666c61742d737175617265)](https://github.com/akalongman/laravel-dummyuser/tags)[![Total Downloads](https://camo.githubusercontent.com/dbbfdaaf3d9910a0bdec66a871df353dd09de9cee3ef1dc3250346a89a7b9efd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4c6f6e676d616e2f6c61726176656c2d64756d6d79757365722e737667)](https://packagist.org/packages/longman/laravel-dummyuser)[![Downloads Month](https://camo.githubusercontent.com/2ec7d020a5f6d7fb28013f71ea80c5db8d5845c19fdd851a67b773709d406c0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f4c6f6e676d616e2f6c61726176656c2d64756d6d79757365722e737667)](https://packagist.org/packages/longman/laravel-dummyuser)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

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

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)

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

[](#installation)

Install this package through [Composer](https://getcomposer.org/).

Edit your project's `composer.json` file to require `longman/laravel-dummyuser`

Create *composer.json* file:

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

And run composer update

**Or** run a command in your command line:

```
composer require longman/laravel-dummyuser

```

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

```
Longman\LaravelDummyUser\DummyUserServiceProvider::class,
```

In the `config/auth.php` file you should add dummy guard in the `guards` array:

```
'guards' => [
    . . .

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

and provider in the `providers` array

```
'providers' => [
    . . .

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

Usage
-----

[](#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)`

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

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

Usage example:

```
