AbstractMenuLoader suggests support for custom loaders (e.g., XML, database, API), but the package lacks documentation or examples for this.VediMenu service + loader) is straightforward. The Twig extension (render_menu) further simplifies adoption.AbstractController, kernel.project_dir, Symfony DI) are incompatible with Laravel’s architecture.ParameterBag (kernel.project_dir) with Laravel’s config/environment paths.VediMenu and YamlMenuLoader to Laravel would require:
spatie/laravel-twig).Router vs. Laravel’s UrlGenerator).AbstractController and getParameter() suggests tight coupling to Symfony’s internals. Laravel’s equivalent (config(), app()->basePath()) may not map 1:1.nav helper or packages like spatie/laravel-menu may suffice.VediMenu and YamlMenuLoader be refactored into a framework-agnostic PHP library (e.g., blackator/menu-core) with Laravel/Symfony adapters?spatie/laravel-menu (DB-driven, Blade/Twig support).orchid/platform (admin panel with menu system).View::composer + Blade directives.VediMenu and AbstractMenuLoader to Laravel’s service container.spatie/laravel-config-array or Laravel’s config() to load YAML files.spatie/laravel-twig to render the @VediMenu/default.html.twig template in Blade.@menu($menu)).View::share() to pass menus globally.config/menu.php or DB.)VediMenu logic into a standalone PHP class.symfony/yaml and Laravel’s filesystem.VediMenu and loaders.
// app/Providers/VediMenuServiceProvider.php
public function register() {
$this->app->singleton(VediMenu::class, function ($app) {
return new VediMenu(new YamlMenuLoader($app->basePath('config/menu')));
});
}
YamlMenuLoader with a Laravel-compatible version:
use Symfony\Component\Yaml\Yaml;
class LaravelYamlMenuLoader extends AbstractMenuLoader {
public function __construct(string $path) {
$this->data = Yaml::parseFile($path);
}
}
spatie/laravel-twig and render @VediMenu/default.html.twig.@component('vedi-menu::default', ['menu' => $menu])
@endcomponent
| Feature | Symfony Support | Laravel Workaround |
|---|---|---|
| YAML Menu Definitions | ✅ Native | ✅ symfony/yaml + Laravel filesystem |
| Twig Rendering | ✅ Native | ⚠️ spatie/laravel-twig or Blade directive |
| Dependency Injection | ✅ Native | ✅ Laravel’s service container |
| Route-Based Menus | ✅ (Symfony Router) | ❌ Custom logic needed (e.g., menu()->route('home')) |
| Caching | ❌ (Not shown) | ✅ Laravel’s cache or Symfony’s cache component |
VediMenu and LaravelYamlMenuLoader.Cache::remember()).templates/bundles/vedimenu/default.html.twig.spatie/laravel-twig.symfony/yaml or spatie/laravel-twig may introduce breaking changes.spatie/laravel-menu for DB-driven menus.Cache::forever('menu.main', $menu).How can I help you explore Laravel packages today?