youshido/security-user
A user and authentication component for Laravel/PHP security, offering user entities, credential handling, and role-based access control hooks for applications that need a ready-made security user layer.
youshido/security-user is a framework-agnostic PHP user/security component, not a Laravel package. There is no service provider, facade, config file, or migration to publish — so "getting started" means deciding whether you should be here at all before writing glue code.
composer require youshido/security-user on a throwaway branch. The last release was February 2016, so expect PHP constraint conflicts on PHP 8.1+ (Laravel 10/11). If Composer refuses, that is your signal — do not force it with --ignore-platform-reqs for auth code.composer.json (autoload + PHP constraint), the README, then the top-level classes in src/. Map which classes are interfaces vs. concrete — only the interfaces are safe to lean on.SecurityUserServiceProvider you own, bound as a singleton in config/app.php providers.Auth::guard() — isolate the package's behavior first.The realistic starting point for most teams: treat this as a reference implementation to read, not code to ship.
Because the package knows nothing about Laravel, every viable pattern is an adapter:
Illuminate\Contracts\Auth\Guard (or extend SessionGuard) and delegate credential validation to the package. Keep the package entirely behind the guard so the rest of the app only ever sees Auth::user().Illuminate\Contracts\Auth\Authenticatable and decorates the package's user object. You must forward getAuthIdentifier(), getAuthPassword(), getRememberToken(), and setRememberToken() correctly or Auth::login() and "remember me" silently break.Auth::attempt($credentials) → your guard → adapter → package credential check → session login. That is the entire happy path; anything more belongs in a service class, not a controller.AuthServiceProvider. Never check package roles directly in Blade or controllers — that is how you end up unable to swap the package later.tests/TestCase so feature tests exercise your adapter, not the package's internals.Hash::make() / Hash::check() (bcrypt/argon2) and borrow only the identity abstraction. Old hashers are the most common source of silent security regressions.psr-4 key. If you get class-not-found on the first bind, run composer dump-autoload -o and inspect composer.json autoload before debugging anything else.SessionGuard relies on exact method names on the Authenticatable. A missing getRememberToken() produces no error — it just quietly fails to persist the session. Test login + remember + logout explicitly.Auth::attempt() without rewriting controllers.Auth::attempt(), and Gates do the same job with active maintenance and a security team behind them. Adopt this only under legacy constraints, and isolate it so removal is a one-file change.How can I help you explore Laravel packages today?