bengor-user/user
Lightweight, flexible user management library built with Domain-Driven Design. Includes registration (basic/confirmation/invitation), password changes and resets, login/logout, user removal, role grant/revoke, and purging outdated invitation/remember tokens.
User, Role, Token entities) and could integrate cleanly into a Laravel application’s domain layer, particularly if the team already embraces DDD principles.Illuminate\Support\Facades for consistency.UserRepository interface).auth, throttle).User entity with Laravel’s Notifiable trait).auth scaffolding cannot provide?users table, PasswordBroker) be migrated to this package’s schema?spatie/laravel-permission, laravel/breeze) that offer better Laravel integration?Laravel Ecosystem:
Illuminate/Foundation will find the package’s ServiceLocator pattern familiar.Illuminate/Contracts/Auth): Requires adapter classes.Hash facade.| Laravel Component | Integration Strategy |
|---|---|
| Eloquent Models | Extend package’s User entity with Illuminate\Database\Eloquent\Model. |
| Request Validation | Use Laravel’s FormRequest to validate inputs before passing to the package. |
| Middleware | Create middleware to translate Laravel’s auth checks to the package’s logic. |
| Queues/Jobs | Wrap package’s token purging in Laravel’s Bus for async execution. |
| Notifications | Implement Illuminate/Notifications/Notifiable on the package’s User. |
PHP Version:
rector/rector to modernize the codebase if forking.use statements, method signatures).Auth::attempt()) to the package’s equivalents (e.g., UserService->login()).UserRegistrationService, keeping other auth flows intact.RoleService, updating policy checks.users, roles, tokens tables) to Laravel’s conventions.Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('email')->unique();
// Add package-specific fields (e.g., `status`, `last_login`)
$table->timestamps();
});
PHPUnit to verify:
Registered, PasswordReset).laravel/framework’s version constraints to enforce compatibility.composer.json snippet:
"require": {
"php": "^8.1",
"laravel/framework": "^10.0",
"bengor-user/user": "dev-master" // or forked version
},
"replace": {
"bengor-user/user": "self.version"
}
spatie/laravel-permission (duplicate role logic). Decide whether to use one or the other.LaravelUserRepository).User entity as a Laravel model.AuthController) with custom controllers using the package.HasApiTokens trait).User with Laravel’s Authenticatable").How can I help you explore Laravel packages today?