tourze/doctrine-user-bundle
A Symfony bundle for Doctrine-backed user management, providing a ready-to-use user entity, repository, password hashing, role handling, and Symfony Security integration to simplify authentication setup.
What this package is. tourze/doctrine-user-bundle is a Symfony bundle — not a Laravel package — that ships a reusable Doctrine ORM user model (base user entity + repository) for projects that manage identities through Doctrine rather than Eloquent. You can use it from Laravel, but you are using it as a library despite the framework, not because of it.
Minimal setup (Laravel host):
composer require tourze/doctrine-user-bundle:^1.0
composer require laravel-doctrine/orm # if you don't already have Doctrine wired in
src/Entity/ (the abstract/base user class you extend) and src/Repository/ (the repository you get for free). Read those two before anything else — they define the contract you inherit.App\Models\User (or App\Entities\User) that extends the bundle's base user class, add your own fields, and point Doctrine's mapping at your subclass, not the vendor class.UserProvider (or bind Illuminate\Contracts\Auth\UserProvider) that delegates to the bundle's user repository, then plug it into an auth guard in config/auth.php.Also read: the bundle's DependencyInjection/ extension and any Resources/config/ service definitions. In Symfony those load automatically; in Laravel they do not, and that file tells you exactly which services and parameters you need to bind by hand.
Extend, don't instantiate. The intended pattern is inheritance: your application user extends the provided base class, keeps its identifier/credential fields, and adds domain fields. Map with Doctrine attributes on your class; do not edit vendor mappings.
Repository as the identity boundary. Wrap the bundle's user repository behind your own class (App\Repositories\UserRepository) rather than injecting it directly into controllers. That gives you one place to change when the vendor bumps a method signature, and one place to add eager-loading or query scoping for multi-tenant setups.
Wire it as an auth provider, not a model. Laravel's Eloquent-centric Auth::attempt() won't work out of the box. Implement retrieveById, retrieveByToken, updateRememberToken, retrieveByCredentials, and validateCredentials against the Doctrine repository. Keep password hashing in Laravel's Hash facade so your validateCredentials matches the rest of the app.
Schema management. Choose one owner of the schema: either Doctrine migrations (doctrine/migrations) or Laravel migrations with raw Schema::create. Mixing the two produces drift the moment you add a field to your subclass. Whichever you pick, generate an initial migration after your subclass is finalized.
Lifecycle hooks. If the bundle exposes Doctrine event subscribers (timestamps, slug/username normalization), register them in your Doctrine manager config explicitly in Laravel — they won't self-register the way Symfony's container would.
Testing. Use an in-memory SQLite connection with doctrine/orm's schema tool to build the schema per test run. It is far faster than migrating MySQL and exercises the same mappings, so a broken attribute mapping fails in CI rather than in production.
Version pinning. Pin to ^1.0. Patch releases in this project carry no readable changelog beyond a compare link, so treat every bump as "read the diff before merging."
bootstrap/providers.php and a small custom service provider that binds the repository and any event subscribers.config/doctrine-user.php and pass them through your provider, or the bundle will silently fall back to defaults.doctrine:schema:validate to confirm mappings parse, (2) dump the metadata for your subclass to confirm it inherits the parent's fields, (3) only then debug auth. Most "user isn't found" reports are metadata problems, not provider problems.Authenticatable, add an adapter rather than fighting the interface in your model.1.0.0...1.0.1 compare link, with no described changes. Diff it yourself before upgrading; a patch on a 1.0.0 launch is typically dependency-constraint or metadata fixes, but "typically" is not a changelog. If nothing in the diff touches your subclass or repository usage, upgrade and move on.How can I help you explore Laravel packages today?