- How do I install **baks-dev/users-user** in a Laravel project?
- Run `composer require baks-dev/users-user` to install the package. For configuration and asset setup, execute `php bin/console baks:assets:install`. Ensure your project uses PHP 8.4+ and Laravel’s latest stable version for compatibility.
- Does this package support Laravel’s Eloquent ORM, or is it strictly Doctrine?
- The package is Doctrine-centric but can integrate with Eloquent via custom repositories or query builders. However, schema conflicts may arise if your project already uses Eloquent’s `users` table. Test migrations in staging first to avoid issues.
- Can I extend the User model for custom roles like AdminUser or TenantUser?
- Yes, the package supports entity inheritance. Use traits or abstract classes to extend the base `User` model for domain-specific logic. Ensure your extensions align with Laravel’s service container and Doctrine’s lifecycle callbacks.
- What Laravel versions are compatible with **baks-dev/users-user**?
- The package requires PHP 8.4+ and is designed for modern Laravel stacks (Laravel 10+). Check the [GitHub releases](https://github.com/baks-dev/users-user/releases) for version-specific notes, as older Laravel versions may lack Doctrine or Symfony compatibility.
- How do I handle authentication (e.g., Sanctum, Passport) with this User entity?
- The package provides the User model but does not include built-in auth logic. Integrate with Laravel Sanctum (API), Passport (OAuth), or Jetstream (UI) by ensuring the User model’s fillable fields (e.g., `password`, `remember_token`) match the auth package’s requirements.
- Are there risks if I already have a users table in my database?
- Yes, Doctrine migrations may alter or drop existing tables. Run `php bin/console doctrine:migrations:diff --dry-run` first to preview changes. Backup your database and consider using the Eloquent bridge or custom migrations to merge schemas if needed.
- How do I test the User entity and its related functionality?
- Run PHPUnit tests with the `--group=users-user` flag: `php bin/phpunit --group=users-user`. For Laravel-specific workflows (e.g., auth middleware, API responses), write additional integration tests using Laravel’s testing tools like `HttpTests` or `FeatureTests`.
- Can I use this package in a microservice architecture?
- Yes, the modular design of **baks-dev/users-user** makes it suitable for microservices where user management is a distinct domain. Deploy the package as a standalone service with its own database schema or integrate it via API contracts (e.g., GraphQL or REST).
- What if I need to roll back migrations after installation?
- Downgrading migrations can break shared dependencies like auth tokens or sessions. Avoid partial rollbacks; instead, use feature flags for gradual adoption. Always test rollback scenarios in a staging environment with a production-like dataset.
- Are there alternatives to this package for Laravel user management?
- For Eloquent-based solutions, consider Laravel Breeze, Jetstream, or Sanctum. If you need Doctrine integration, explore packages like **Spatie’s Laravel-Permission** or **API Platform’s Admin**. Evaluate alternatives based on your project’s ORM preference and whether you need Doctrine’s advanced features.