Download the PHP package cdoebler/php-generic-user-switcher without Composer

On this page you can find all versions of the php package cdoebler/php-generic-user-switcher. 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 php-generic-user-switcher

PHP Generic User Switcher

A framework-agnostic PHP package for user switching with an integrated frontend component. Perfect for development and debugging, allowing seamless impersonation of different users without logging in and out.

Features

Requirements

Installation

Install via Composer:

Quick Start

Basic Usage

Handling User Switching

In your application's bootstrap or middleware, handle the switch request:

Usage Examples

Example 1: Simple In-Memory Users

Example 2: Custom Position and Styling

Example 3: Custom Session Key

Example 4: Database User Provider

Create a custom provider that loads users from your database:

Example 5: Custom User Implementation

Implement the UserInterface for your existing user models:

Example 6: Laravel Integration

Example 7: Symfony Integration

Configuration Options

Renderer Options

The UserSwitcherRenderer::render() method accepts an array of options:

Option Type Default Description
position string 'bottom-right' Widget position: top-left, top-right, bottom-left, bottom-right
z_index int 9999 CSS z-index value for the floating widget
param_name string '_switch_user' URL query parameter name used for switching users

SessionImpersonator Options

Interface Reference

UserInterface

UserProviderInterface

ImpersonatorInterface

Security Considerations

This package is designed for development and debugging purposes only.

Important security notes:

  1. Never enable in production - User switching should only be available in development/staging environments
  2. Add authorization checks - Ensure only authorized users (admins, developers) can switch users
  3. Environment gating - Use environment checks to disable in production:

  4. Audit logging - Consider logging all impersonation events for security auditing

Example: Implementing Audit Logging

The package supports optional audit logging to track all impersonation events:

Development

Running Tests

Code Quality

This package maintains high code quality standards:

Architecture

Contributing

Contributions are welcome! Please ensure:

  1. All tests pass (composer test)
  2. Code follows PSR-12 standards
  3. PHPStan level 10 passes
  4. New features include tests

License

MIT License. See LICENSE.md file for details.

Author

Christian Doebler

Changelog

1.0.0 (Current)


All versions of php-generic-user-switcher with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 cdoebler/php-generic-user-switcher contains the following files

Loading the files please wait ...