Download the PHP package ukeloop/laravel-impersonatable-guard without Composer

On this page you can find all versions of the php package ukeloop/laravel-impersonatable-guard. 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 laravel-impersonatable-guard

Laravel Impersonatable Guard

This is a guard implementation in Laravel for handling user impersonation. It extends Laravel's SessionGuard and provides additional methods for impersonation-related functionality.

User impersonation is a feature that enables an administrator or privileged user to temporarily assume the identity of another user within the application. This capability proves valuable for troubleshooting, testing user-specific features, or providing support.

Moreover, It supports multiple authentication guards. For example, admin guard users can also impersonate web guard users.

Security Considerations

User impersonation should be used with caution, especially in production environments. It's important to properly authenticate and authorize users before allowing them to impersonate others. Additionally, sensitive actions or pages should be protected from access while in impersonation mode to prevent unauthorized use.

Installation

You can install this package via Composer:

Configuration

Update your authentication configuration to use the ImpersonatableSessionGuard instead of Laravel's default SessionGuard. You need to replace the driver from session to impersonatable.session:

Usage

Impersonate Users

Start impersonating the specified user. This method takes an instance of Illuminate\Contracts\Auth\Authenticatable representing the user to impersonate.

Once Impersonate Users

Temporarily impersonate the specified user for a single request. This method is useful for actions that need to be performed as another user without permanently switching the user context.

Exit Impersonation

Stop impersonating the current user and return to the original user context.

Get Original User

Get the original user that was being impersonated.

Check Currently impersonated state

Check if the guard is currently in an impersonated state.

Protect Impersonation With Middleware

You can use the middleware impersonation.protect to protect your routes against user impersonation. This middleware ensures that users cannot access certain routes while impersonating another user.

Protect with specified guards:

Example Impersonation Controller

Example controller for impersonating users:

Custom Impersonate Guard

You can create custom impersonate guards by implementing Ukeloop\ImpersonatableGuard\Contracts\ImpersonatableGuard.


All versions of laravel-impersonatable-guard with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/auth Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/queue Version ^11.0|^12.0
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 ukeloop/laravel-impersonatable-guard contains the following files

Loading the files please wait ....