custom-d/cd-laravel-user

Api based User management


README

support-ukraine.svg?t=1

Api based User management

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

cd-laravel-user.jpg?t=1

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require custom-d/cd-laravel-user

You can publish and run the migrations with:

php artisan vendor:publish --tag="cd-laravel-user-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="cd-laravel-user-config"

This is the contents of the published config file:

return [
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="cd-laravel-user-views"

Usage

$cdLaravelUser = new CustomD\CdLaravelUser();
echo $cdLaravelUser->echoPhrase('Hello, CustomD!');

Impersonation:

1) add the followig method With your own inner logic to the User Model: (both default to true if not setup)

 public function canBeImpersonated(): bool
    {
        return ! $this->hasAnyRole('Developer');
    }

 public function canImpersonate(): bool
    {
        return  $this->hasAnyRole('Developer');
    }

If you have encryption enabled: in your key provider methods to get PrivateKeyForRecord: $user = app(ImpersonateManager::class)->getImpersonator() ?? auth()->user(); // @phpstan-ignore-line to get the user for the keystore.

## Password reset Env: CD_LARAVEL_USER_PASSWORD_RESET_ALWAYS_PASS default false, if set to true, password resets requests will always return a success even if the user does not exist.

you can also override the validation rules in teh config file: ie: add email address exists and is validated etc.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see [CONTRIBUTING](https://github.com/Custom D/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.