alphalemon/app-business-menu-bundle
Installation
composer require alphalemon/app-business-menu-bundle
Ensure alphalemon/alphalemon-cms-bundle is installed (dev dependency) and properly configured in your Laravel project.
Publish Assets & Config
php artisan vendor:publish --provider="AlphaLemon\BusinessMenuBundle\BusinessMenuBundle" --tag=config
php artisan vendor:publish --provider="AlphaLemon\BusinessMenuBundle\BusinessMenuBundle" --tag=public
This registers the menu content type and editor in the CMS.
First Use Case: Create a Menu
Render in Blade
@inject('businessMenu', 'AlphaLemon\BusinessMenuBundle\Service\BusinessMenuService')
{{ $businessMenu->render('menu-slug-or-id') }}
Replace 'menu-slug-or-id' with your menu’s identifier (defined in the CMS).
Menu Creation & Management
menu_type field in the CMS.Dynamic Rendering
$menuItems = $businessMenu->getMenuItems('header-menu');
foreach ($menuItems as $item) {
echo '<li><a href="' . $item->url . '">' . $item->title . '</a></li>';
}
@businessMenu('footer-menu', 'partials.menu-item')
Integration with Routes
$menu = $businessMenu->findBySlug('main-nav');
$routeName = $menu->items->first()->route_name;
url($routeName);
Theming & Styling
php artisan vendor:publish --tag=business-menu-views
public publish tag.Conditional Menus
$activeMenu = $businessMenu->getActiveMenu(request()->path());
Cache::remember('menu-header', now()->addHours(1), function () {
return $businessMenu->getMenu('header');
});
BusinessMenuBundle::onMenuUpdated(function ($menu) {
// Sync with a headless CMS or analytics tool
});
Route::get('/api/menus/{slug}', [BusinessMenuController::class, 'show']);
Missing CMS Integration
alphalemon-cms-bundle (dev dependency). If not installed, the editor and content type won’t register.alphalemon-cms-bundle is installed and configured before using this bundle.Menu Slug Collisions
Template Overrides Not Loading
php artisan view:clear
Performance with Large Menus
Deprecated Methods
CHANGELOG.md (if exists) or open an issue on GitHub for clarification.Log Menu Data:
\Log::debug('Menu items:', $businessMenu->getMenuItems('test-menu'));
Check Published Config:
php artisan config:clear
Then inspect config/business_menu.php for overrides.
Editor Not Showing:
apps config includes business_menu.Custom Menu Fields
// Example: Add a 'priority' field
$businessMenu->addField('priority', 'integer', ['default' => 0]);
src/Entity/MenuItem.php).Custom Renderers
$this->app->bind('AlphaLemon\BusinessMenuBundle\Renderer\MenuRendererInterface', CustomMenuRenderer::class);
Menu Sync with External Sources
BusinessMenuBundle::onMenuUpdated event to sync with:
Localization
app locale:
$menu = $businessMenu->getMenu('main-nav', app()->getLocale());
Testing
$this->app->instance('AlphaLemon\BusinessMenuBundle\Service\BusinessMenuService', MockBusinessMenuService::class);
$this->get('/')->assertSee('Menu Item Title');
How can I help you explore Laravel packages today?