2017 © Pedro Peláez
 

library impersonate

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

image

bpocallaghan/impersonate

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

  • Wednesday, September 20, 2017
  • by bpocallaghan
  • Repository
  • 4 Watchers
  • 4 Stars
  • 1,457 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 16 % Grown

The README.md

Impersonation (Laravel Authentication)

Laravel 5 package to enable impersonation. Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers., (*1)

See it in action at a Laravel Admin Starter project., (*2)

Installation

Update your project's composer.json file., (*3)

composer require bpocallaghan/impersonate --dev

Laravel <5.4 only (Laravel 5.5 has automatic package discovery)br/ Register the Service Provider in your config/app or in your app/Providers/AppServiceProvider.php to only allow it for development., (*4)

public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register(\Bpocallaghan\Impersonate\ImpersonateServiceProvider::class);
    }
}

Usage

impersonate()->login($user) Impersonate the given user and save the currently logged in user in session.br/ impersonate()->logout() Logout the impersonated user and log the original user back in.br/ impersonate()->isActive() If the logged in user is currently being impersonated by another user., (*5)

You can register your own routes. For example you want to change the endpoints or update the middlewares, etc. If you need to do additional validation, register your own Controller and only use the above methods. You can create your own view file to handle the login / logout functionality. The view file included is mostly for reference., (*6)

Config

register_routes If the package will register the routes or if you rather prefer to add your own.br/ session The session keys that will be used. Save original user and if currently impersonating a user., (*7)

Publish Assets (optional)

Publish the config and view file., (*8)

php artisan vendor:publish --provider="Bpocallaghan\Impersonate\ImpersonateServiceProvider" --tag=view
php artisan vendor:publish --provider="Bpocallaghan\Impersonate\ImpersonateServiceProvider" --tag=config

In your view forms to login or logout. You can add a hidden input with name 'redirect_to' to specify the return redirect to url after login / logout., (*9)

Disclaimer

Please use the package with caution. By using this package, you agree that the contributors of this package cannot be held responsible for any damages caused by using this package., (*10)

The Versions

20/09 2017

dev-master

9999999-dev

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

laravel development users impersonate impersonation login as

20/09 2017

1.0.0

1.0.0.0

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

laravel development users impersonate impersonation login as

27/06 2017

0.1.0

0.1.0.0

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel development users impersonate impersonation login as