- Can I use this bundle directly in Laravel without Symfony?
- No, this is a Symfony bundle, but you can integrate it via Laravel’s Symfony bridge (e.g., `spatie/symfony-components`) or adapt its core features (storage, permissions) to Eloquent. Doctrine ORM would require `laravel-doctrine`, while the Vue 3 admin could run as a micro-frontend or embed via Vite.
- How do I replace Doctrine storage with Eloquent in Laravel?
- Rewrite the storage layer to use Eloquent models instead of Doctrine entities. The bundle’s `position`-based tree logic can be adapted with Laravel’s `orderBy` or packages like `spatie/laravel-activitylog` for soft deletes. The CLI sync feature would need attribute-to-Eloquent mapping.
- Does this support Laravel’s built-in authentication (Breeze/Sanctum) for menu permissions?
- Yes, but you’ll need to replace Symfony’s `SecurityVoter` with Laravel’s `Gate` or `Policy` system. The role-based visibility model (e.g., `ROLE_ADMIN`) maps directly, but the admin UI’s permission checks would require frontend adjustments if using Vue 3.
- What’s the best way to integrate the Vue 3 admin panel in Laravel?
- Option 1: Embed the Vue 3 SPA via Laravel’s Vite (if using Inertia.js) or serve it as a separate micro-frontend at `/admin`. Option 2: Decouple it entirely and call its REST API from Laravel. The admin’s API endpoints would need Laravel routing (e.g., `Route::apiResource`).
- Will this work with Laravel’s localization (e.g., `spatie/laravel-translatable`)?
- Yes, the bundle’s per-locale labels and URIs align with Laravel’s localization systems. Use `spatie/laravel-translatable` for Eloquent models or adapt the Symfony `Translator` integration to Laravel’s `App::setLocale()`. The `previewLocale` feature in the admin can mirror Laravel’s locale switching.
- How do I handle deep menu trees (e.g., 1000+ items) in production?
- The bundle’s tree queries use `position`-based ordering (not recursive CTEs), which scales well. For large menus, enable the Redis or Cache backend to avoid Doctrine queries. Add database indexes on `position`, `publishedAt`, and `locale`. Test with `DB::enableQueryLog()` to optimize.
- Are there Laravel-native alternatives with similar features?
- For Laravel, consider `spatie/laravel-menu` (simpler, Eloquent-based) or `orchid/software` (full CMS with menus). If you need Vue 3 + REST API, `filament/filament` (with custom resources) or `backpack/menu` (admin panel) are alternatives. This bundle’s strength is its Symfony ecosystem integration.
- How do I migrate existing Laravel menu logic to this bundle?
- Phase 1: Replace your menu models with the bundle’s storage (Doctrine/Eloquent). Phase 2: Adapt Blade templates to Twig (or convert to Blade) and rewrite routes to use the bundle’s REST API. Phase 3: Sync permissions by mapping Symfony roles to Laravel’s `Gate::forUser()`. Use the CLI `sync` command to import legacy menu items.
- Does the bundle support soft deletes in Laravel?
- Soft deletes work via Doctrine’s `SoftDeleteable` trait if using the Doctrine backend. For Eloquent, implement Laravel’s `SoftDeletes` trait on your menu model and ensure the bundle’s `isDeleted()` logic is overridden. The Vue 3 admin’s trash/restore features would need frontend adjustments.
- What Laravel versions and dependencies does this bundle support?
- This is a Symfony bundle, so Laravel compatibility depends on your integration approach. For Symfony components (e.g., Doctrine), target Laravel 9+ with PHP 8.1+. Native Laravel use requires Eloquent, which may need manual adaptation. Check the [Symfony requirements](https://symfony.com/doc/current/setup.html) for bundled dependencies like Redis or Cache.