Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicoaudy/impersonate
https://github.com/nicoaudy/impersonate
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nicoaudy/impersonate
- Owner: nicoaudy
- License: other
- Created: 2020-01-16T08:20:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-16T08:26:48.000Z (about 5 years ago)
- Last Synced: 2025-01-10T16:28:35.138Z (9 days ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license.md
Awesome Lists containing this project
README
# Laravel Impersonate
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]Simple package that do the trick, Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of your users in one click.
## Installation
Via Composer
``` bash
$ composer require nicoaudy/impersonate
```Add traits to your user model
```php
// User.phpuse NicoAudy\Impersonate\Traits\Impersonate;
class User extends Authenticatable
{
use Notifiable, Impersonate;
// Other stuff
}
```Register Middleware to route
```php
Route::middleware('impersonate')->group(function(){
// your routes can be impersonates
});
```## Usage
Impersonate a user :
```php
Auth::user()->setImpersonating($other_user_id);
```Stop impersonating :
```php
Auth::user()->stopImpersonating();
```Check if current user impersonating :
```php
Auth::user()->isImpersonating();
```## Change log
Please see the [changelog](changelog.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Security
If you discover any security related issues, please email author email instead of using the issue tracker.
## Credits
- [NicoAudy][link-author]
## License
license. Please see the [license file](license.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/nicoaudy/impersonate.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/nicoaudy/impersonate.svg?style=flat-square[link-packagist]: https://packagist.org/packages/nicoaudy/impersonate
[link-downloads]: https://packagist.org/packages/nicoaudy/impersonate
[link-author]: https://github.com/nicoaudy