1. Go to this page and download the library: Download unlooped/menu-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unlooped / menu-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new Unlooped\MenuBundle\UnloopedMenuBundle(),
];
// ...
}
// ...
}
namespace App\Service;
use Doctrine\Common\Annotations\AnnotationException;
use ReflectionException;
use Unlooped\MenuBundle\Exception\NameForMenuAlreadyExistsException;
use Unlooped\MenuBundle\Exception\ShowAndHideAnnotationSetException;
use Unlooped\MenuBundle\Helper\MenuHelper;
use Unlooped\MenuBundle\Service\AbstractMenuBuilderService;
class MenuBuilderService extends AbstractMenuBuilderService
{
/**
* @throws NameForMenuAlreadyExistsException
* @throws AnnotationException
* @throws ReflectionException
* @throws ShowAndHideAnnotationSetException
*/
public function createMainMenu(): MenuHelper
{
return $this->createMenuHelper()
->addMenu('Link A', ['route' => 'route_name_a'])
->addMenu('Link B', ['route' => 'route_name_b'])
->addMenu('Link C', ['route' => 'route_name_c'])
;
}
}