- Can this package work with Laravel 10 or PHP 8.2+?
- No, this package was last updated in 2017 and lacks support for Laravel 10 or PHP 8.2+. You’d need to fork and maintain it yourself, or evaluate alternatives like jenssegers/laravel-mongodb for modern Laravel versions.
- How do I integrate Doctrine ODM with Laravel’s authentication system?
- You’ll need to create a custom UserProvider that bridges Doctrine ODM’s UserRepository with Laravel’s Auth facade. Extend Laravel’s Authenticatable trait in your Doctrine-annotated User model and override methods like retrieveByCredentials().
- Does this package support Laravel’s built-in auth scaffolding (e.g., Make:Auth)?
- No, this package assumes Symfony’s UserInterface. You’ll need to manually adapt Laravel’s auth scaffolding (e.g., MustVerifyEmail, Notifiable) by implementing traits or custom interfaces alongside Doctrine ODM annotations.
- What’s the performance impact of using Doctrine ODM vs. native Laravel MongoDB drivers?
- Doctrine ODM introduces overhead due to its abstraction layer. For high-traffic user operations (e.g., logins), benchmark against jenssegers/laravel-mongodb or native Eloquent with MongoDB. ODM may be slower but offers advanced features like @ReferenceOne.
- How do I migrate existing Laravel user data (passwords, roles) to MongoDB with this package?
- Use Laravel’s Eloquent to export SQL users, then manually map them to Doctrine ODM documents. Ensure password hashing (e.g., bcrypt) remains consistent. Test migrations thoroughly, as schema differences between SQL and MongoDB may require custom logic.
- Will this work with Laravel’s Breeze or Jetstream for authentication?
- No, this package doesn’t integrate with Laravel’s first-party auth stacks. You’d need to replace Breeze/Jetstream’s User model with a Doctrine ODM-annotated version and rebuild auth logic (e.g., registration, password resets) manually.
- Are there alternatives for MongoDB + Laravel auth that are actively maintained?
- Yes, consider jenssegers/laravel-mongodb (native MongoDB support) or spatie/laravel-mongodb (more Laravel-idiomatic). If you need Doctrine ODM’s features, evaluate doctrine/mongodb-odm-bundle (Symfony) and adapt it for Laravel.
- How do I configure Doctrine ODM in Laravel without Symfony’s bundle?
- Manually register Doctrine ODM’s services in Laravel’s AppServiceProvider. Configure the MongoDB connection in `config/services.php` and bind the ODM DocumentManager to the container. Follow doctrine/mongodb-odm’s standalone setup guide for Laravel.
- Does this package support MongoDB’s schema-less flexibility for user models?
- Yes, but you’ll lose Laravel’s migrations. Use Doctrine ODM’s dynamic mapping or embed documents for flexible schemas. Document your schema evolution carefully, as MongoDB lacks traditional migrations.
- What if I need Doctrine ODM’s advanced features (e.g., @EmbeddedDocument) but want Laravel compatibility?
- This package provides a starting point, but you’ll need to extend it. For example, create a base DoctrineLaravelUser trait to merge Laravel’s auth methods with ODM annotations. Test thoroughly, as hybrid setups can introduce edge cases.