custom-d / cd-laravel-user
Api based User management
Requires
- php: ^8.1
- illuminate/contracts: ^9.0|^10.0
- lab404/laravel-impersonate: ^1.7
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- custom-d/eloquent-model-encrypt: ^3.1
- custom-d/user-security-recovery: ^2.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0|^7.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0|^8.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpsa/laravel-api-controller: ^6.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5|^10.0
- dev-master
- v0.6.0
- v0.5.0
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- v0.3.1
- v0.3.0
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.1
- V0.1.0
- dev-renovate/orchestra-testbench-9.x
- dev-renovate/phpunit-phpunit-11.x
- dev-renovate/major-illuminate
- dev-renovate/nunomaduro-collision-8.x
- dev-renovate/phpsa-laravel-api-controller-7.x
- dev-renovate/pestphp-pest-plugin-laravel-2.x
- dev-renovate/pestphp-pest-2.x
This package is auto-updated.
Last update: 2024-11-16 13:54:13 UTC
README
Api based User management
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Support us
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
- [Custom D](https://github.com/Custom D)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.