{"id":24650799,"url":"https://github.com/tangoman75/menubundle","last_synced_at":"2026-05-04T22:42:03.168Z","repository":{"id":114062124,"uuid":"102492413","full_name":"TangoMan75/MenuBundle","owner":"TangoMan75","description":"TangoMan Menu Bundle provides an easy way to include menus in twig. TangoMan Menu Bundle makes building back-office for your app a brease.","archived":false,"fork":false,"pushed_at":"2017-09-14T07:23:13.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T21:07:34.500Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TangoMan75.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-05T14:35:03.000Z","updated_at":"2020-09-04T19:37:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e36e2c41-0035-4432-9bdc-36b7544b951d","html_url":"https://github.com/TangoMan75/MenuBundle","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/TangoMan75/MenuBundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FMenuBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FMenuBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FMenuBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FMenuBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TangoMan75","download_url":"https://codeload.github.com/TangoMan75/MenuBundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FMenuBundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263710498,"owners_count":23499706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-25T18:16:42.760Z","updated_at":"2026-05-04T22:41:58.148Z","avatar_url":"https://github.com/TangoMan75.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"TangoMan Menu Bundle\n====================\n\n**TangoMan Menu Bundle** provides an easy way to include menus in twig.\n**TangoMan Menu Bundle** makes building back-office for your app a brease.\n\nInstallation\n============\n\nStep 1: Download the Bundle\n---------------------------\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```bash\n$ composer require tangoman/menu-bundle\n```\n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\nStep 2: Enable Bundles\n----------------------\n\n**TangoMan Menu Bundle** requires **TangoMan Callback Bundle** to function properly.  \nEnable both bundles by adding it to the list of registered bundles \nin the `app/AppKernel.php` file of your project:\n\n```php\n\u003c?php\n// app/AppKernel.php\n\n// ...\nclass AppKernel extends Kernel\n{\n    // ...\n\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new TangoMan\\CallbackBundle\\TangoManCallbackBundle(),\n            new TangoMan\\MenuBundle\\TangoManMenuBundle(),\n        );\n\n        // ...\n    }\n}\n```\n\nStep 3: Place use statement in the controller\n---------------------------------------------\n\n```php\nuse TangoMan\\MenuBundle\\Model\\Item;\nuse TangoMan\\MenuBundle\\Model\\Menu;\n```\n\nStep 4: Build object in the controller\n--------------------------------------\n\n```php\n\u003c?php\n// AppBundle/Controller/DefaultController.php\nnamespace AppBundle\\Controller;\n\n// ...\n\nclass DefaultController extends Controller\n{\n    /**\n     * @Route(\"/user/index\")\n     */\n    public function indexAction()\n    {\n        // ...\n\n        $menu = new Menu();\n\n        $item = new Item();\n        $item-\u003esetLabel('Tableau de bord')\n            -\u003esetRoute('app_admin_admin_index')\n            -\u003esetIcon('glyphicon glyphicon-dashboard');\n        $menu-\u003eaddItem($item);\n\n        $item = new Item();\n        $item-\u003esetDivider(true);\n        $menu-\u003eaddItem($item);\n\n        $item = new Item();\n        $item-\u003esetLabel('Articles')\n            -\u003esetRoute('app_admin_post_index')\n            -\u003esetIcon('glyphicon glyphicon-text-color');\n        $menu-\u003eaddItem($item);\n\n        $item = new Item();\n        $item-\u003esetLabel('Commentaires')\n            -\u003esetRoute('app_admin_comment_index')\n            -\u003esetIcon('glyphicon glyphicon-comment');\n        $menu-\u003eaddItem($item);\n\n        $item = new Item();\n        $item-\u003esetDivider(true);\n        $menu-\u003eaddItem($item);\n\n        $item = new Item();\n        $item-\u003esetLabel('Utilisateurs')\n            -\u003esetRoute('app_admin_user_index')\n            -\u003esetIcon('glyphicon glyphicon-user');\n        $menu-\u003eaddItem($item);\n\n        // You can use json format as well\n        $navbar = '{\n            \"label\": \"TangoMan\",\n            \"route\": \"homepage\",\n            \"icon\": \"fa fa-car\",\n            \"items\": [\n                {\n                    \"label\": \"Blog\",\n                    \"route\": \"app_posts_index\"\n                },\n                {\n                    \"subMenu\": {\n                        \"label\": \"Administration\",\n                        \"icon\": \"fa fa-cogs\",\n                        \"roles\": [\"ROLE_ADMIN\"],\n                        \"items\": [\n                            {\n                                \"label\": \"User\",\n                                \"icon\": \"fa fa-users\",\n                                \"route\": \"admin_user_index\",\n                                \"active\": \"admin_user_index\"\n                            },\n                            {\n                                \"divider\": true\n                            },\n                            {\n                                \"label\": \"Comments\",\n                                \"icon\": \"fa fa-comments\",\n                                \"route\": \"admin_comment_index\",\n                                \"active\": \"admin_comment_index\"\n                            }\n                        }\n                    }\n                }\n            ]\n        }';\n\n        // You can also add id or slug to route parameters when necessary: \n        $tabs = '{\n            \"items\": [\n                {\n                    \"label\": \"List\",\n                    \"route\": \"app_admin_user_index\",\n                    \"active\": \"index\",\n                    \"icon\": \"glyphicon glyphicon-list\"\n                },\n                {\n                    \"label\": \"Add\",\n                    \"route\": \"app_admin_user_new\",\n                    \"active\": \"new\",\n                    \"icon\": \"glyphicon glyphicon-plus\"\n                },\n                {\n                    \"label\": \"Import\",\n                    \"route\": \"app_admin_user_import\",\n                    \"active\": \"import\",\n                    \"icon\": \"glyphicon glyphicon-import\"\n                },\n                {\n                    \"label\": \"Export\",\n                    \"route\": \"app_admin_user_export\",\n                    \"active\": \"export\",\n                    \"icon\": \"glyphicon glyphicon-export\"\n                },\n                {\n                    \"label\": \"Edit\",\n                    \"route\": \"app_admin_user_edit\",\n                    \"id\": 1,\n                    \"active\": \"edit\",\n                    \"icon\": \"glyphicon glyphicon-edit\"\n                }\n            ]\n        }';\n\n        return $this-\u003erender(\n            'user/index.html.twig',\n            [\n                'navbar' =\u003e $menu,\n                'menu' =\u003e $menu,\n                'tabs' =\u003e $tabs,\n                'users' =\u003e $users,\n            ]\n        );\n    }\n}\n```\n\nStep 5: Integrate in Twig\n-------------------------\n\n```twig\n\u003cdiv class=\"container\"\u003e\n    {{ menu(menu, 'navbar') }}\n\u003c/div\u003e\n```\n\n```twig\n\u003cdiv id=\"sidebar-menu\" class=\"col-xs-12 col-sm-2\"\u003e\n    {{ menu(menu) }}\n\u003c/div\u003e\n```\n\n```twig\n\u003cdiv id=\"tabs\"\u003e\n    {{ menu(menu, 'tabs') }}\n\u003c/div\u003e\n```\n\nHow to use\n----------\n\nTo make sure twig can create routes name them like following:\n - 'app_login'\n - 'app_check'\n - 'app_logout'\n - 'app_user_profile'\n - 'app_user_edit'\n - 'app_admin_index'\n - 'homepage'\n\nNote\n====\n\nIf you find any bug please report here : [Issues](https://github.com/TangoMan75/MenuBundle/issues/new)\n\nLicense\n=======\n\nCopyrights (c) 2017 Matthias Morin\n\n[![License][license-GPL]][license-url]\nDistributed under the GPLv3.0 license.\n\nIf you like **TangoMan Menu Bundle** please star!\nAnd follow me on GitHub: [TangoMan75](https://github.com/TangoMan75)\n... And check my other cool projects.\n\n[tangoman.free.fr](http://tangoman.free.fr)\n\n[license-GPL]: https://img.shields.io/badge/Licence-GPLv3.0-green.svg\n[license-MIT]: https://img.shields.io/badge/Licence-MIT-green.svg\n[license-url]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Fmenubundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangoman75%2Fmenubundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Fmenubundle/lists"}