Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Monofony Menu Extension

Monofony Menu Extension Laravel Package

allekslar/monofony-menu-extension

View on GitHub
Deep Wiki
Context7

Adds 'sylius.menu.admin.main' event for Monofony/Skeleton

Frequently asked questions about Monofony Menu Extension
Does this package work with vanilla Laravel projects?
No, this package is specifically designed for Sylius-based frameworks like Monofony/Skeleton. It relies on Sylius’s event system, which isn’t natively available in Laravel. For Laravel, consider alternatives like `spatie/laravel-menu` or custom Blade directives.
How do I add a custom menu item to the Sylius admin dashboard?
Create an event subscriber that listens to `sylius.menu.admin.main`. In the subscriber’s `onMenuBuild` method, modify the `$menu` array to inject your custom items. Ensure your subscriber is tagged as a service in your `services.yaml` or `config/packages`.
What Laravel versions support this package?
This package isn’t Laravel-native, but it can work in Laravel projects *if* you’re using Sylius (e.g., via `sylius/sylius` or `monofony/skeleton`). For pure Laravel, it’s incompatible. Check Symfony 6.x and PHP 8.0+ compatibility for your stack.
Is there a way to dynamically populate menu items based on user roles?
Yes, in your event subscriber, access the `Security` component or `TokenStorage` to check user roles. Modify the `$menu` array conditionally, like adding a `Reports` section only for admin users. Example: `if ($this->security->isGranted('ROLE_ADMIN')) { ... }`
Will this package break if I update Sylius or Monofony?
Potential risks exist if Sylius changes the `sylius.menu.admin.main` event structure or namespace. Test thoroughly after updates. If the event is deprecated, you may need to override the Twig template directly or use a fallback subscriber.
Can I use this with Sylius 0.x or older versions?
No, this package targets Sylius 1.x and Symfony 6.x. Older Sylius versions may use different event namespaces (e.g., `sylius.menu.main`). Check your Sylius version’s documentation for compatibility or use a custom Twig override as a fallback.
How do I test if the menu extension is working?
Clear Symfony’s cache (`php bin/console cache:clear`) and reload the Sylius admin dashboard. Verify your custom menu item appears. Use browser dev tools to inspect the rendered HTML or add debug logs in your subscriber’s `onMenuBuild` method.
What if the event `sylius.menu.admin.main` doesn’t exist in my setup?
This likely means your Sylius/Monofony version doesn’t support the event. As a fallback, manually extend the menu template in Twig by overriding `SyliusAdminBundle:Menu:main.html.twig` and adding your items in the `menu_items` block.
Are there alternatives for Laravel projects without Sylius?
For Laravel, consider `spatie/laravel-menu` for dynamic Blade-based menus or `orchid/platform` for admin panel integrations. If you need Sylius-like functionality, evaluate `sylius/sylius` or `monofony/skeleton` as a foundation before using this package.
Does this package handle menu permissions or routing automatically?
No, this package only injects menu items into the existing Sylius admin menu. You must manually define routes (e.g., in `routes.yaml`) and handle permissions (e.g., via Symfony’s voter system or Sylius’s guard system) separately.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime