- Can I use alessandrolandim/multi-user-bundle in a pure Laravel project without Symfony?
- No, this bundle is designed for Symfony and relies on Doctrine ORM, Symfony’s dependency injection, and UserBundle. For Laravel, you’d need to rewrite core components or use Laravel-native alternatives like spatie/laravel-multitenancy. The bundle lacks Laravel service providers or Eloquent support.
- What Laravel versions does this bundle support?
- This bundle does not officially support Laravel—it’s a Symfony fork. If you’re using Laravel with a Symfony bridge (e.g., Lumen or Symfony components), compatibility depends on your setup. For pure Laravel, no version support exists.
- How do I install this bundle in a Symfony project?
- Run `composer require alessandrolandim/multi-user-bundle`, then configure it in `config/packages/security.yaml` and `config/packages/pugx_multi_user.yaml`. Ensure Doctrine ORM is installed and your User entity implements Symfony’s `UserInterface`. Follow the original PUGXMultiUserBundle docs for schema setup.
- Does this bundle support soft multi-tenancy (shared database with tenant IDs)?
- Yes, the bundle appears to support soft multi-tenancy by isolating users/tenants via tenant IDs in the database. However, Laravel alternatives like stancl/tenancy or spatie/laravel-multitenancy are more mature for this use case and include better documentation.
- What are the risks of using this bundle in production?
- Key risks include outdated dependencies (e.g., doctrine/common:^2.2), lack of maintenance (0 stars/dependents), and Symfony-specific code that may not align with Laravel’s architecture. Security vulnerabilities from the original Symfony 2.x bundle could also pose threats.
- How do I migrate existing User/Group data from Doctrine to Eloquent?
- You’ll need to manually map Doctrine’s schema (User, Group, UserGroup tables) to Eloquent models. Use Laravel migrations to recreate tables, then write a data migration script to transform records. The bundle’s schema assumes Doctrine, so adjustments are required.
- Are there Symfony-specific tests that won’t work in Laravel?
- Yes, tests likely rely on Symfony’s PHPUnit bridge, EventDispatcher, and Container components. If you fork the bundle for Laravel, you’d need to rewrite tests to use Laravel’s testing tools (e.g., Laravel’s HTTP tests, mocking services).
- What’s a better alternative for Laravel multi-tenancy?
- For Laravel, consider spatie/laravel-multitenancy (shared database) or stancl/tenancy (separate databases). Both are actively maintained, Laravel-native, and offer features like tenant middleware, model observers, and database switching. They avoid Symfony’s dependencies entirely.
- Can I use this bundle alongside Laravel’s Breeze or Fortify for authentication?
- No, this bundle replaces Symfony’s UserBundle, which conflicts with Laravel’s auth scaffolding (Breeze/Fortify). If you need multi-tenancy, integrate it with Laravel’s auth via middleware or events, but avoid mixing the two systems.
- How do I handle tenant switching in requests with this bundle?
- In Symfony, tenant switching is typically handled via middleware or request listeners tied to the bundle’s tenant logic. In Laravel, you’d need to create custom middleware to extract tenant IDs (e.g., from subdomains or headers) and apply them to queries. The bundle’s tenant-aware logic won’t work out-of-the-box.