Download the PHP package sclaravel/menus without Composer

On this page you can find all versions of the php package sclaravel/menus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package menus

Laravel Menus

Installation

You can install the through composer command line.

Publish package's assets by running:

Creating A Menu

You can define your menus in app/Menus/Left.php file. That file will loaded automatically by this package.

To create a menu, simply call the create or make method from Menu facade. The first parameter is the menu name and the second parameter is callback for defining menu items.

`

Menu Item

As explained before, we can defining menu item in the callback by accessing $menu variable, which the variable is instance of TysonLaravel\Menus\Builder class.

To defining a plain URL, you can use ->url() method.

If you have named route, you define the menu item by calling ->route() method.

You can also defining the menu item via array by calling ->add() method.

Menu Attibutes

Attibutes Detail
target
icon

Menu Dropdown

To create a dropdown menu, you can call to ->dropdown() method and passing the first parameter by title of dropdown and the second parameter by closure callback that retrive $sub variable. The $sub variable is the the instance of TysonLaravel\Menus\MenuItem class.

Menu Dropdown Multi Level

You can also create a dropdown inside dropdown by using ->dropdown() method. This will allow to to create a multilevel menu items.

Menu Divider

You may also define a divider for each menu item. You can divide between menu item by using ->divider() method.

Dropdown Header

You may also add a dropdown header for the specified menu item by using ->header() method.

Ordering Menu Item

You may order the menu by specify order parameter.

You may also set the order value by calling ->order method.

By default ordering feature is disabled. You can enable the ordering feature in your config file. Just update value of ordering config to true and now your menu will ordered by order key.

You may also enable or disable menu ordering for each menu via ->enableOrdering and ->disableOrdering method.

Make Lots of menu

You can also create a lots of menu with different name and menu items.

Menu Presenter

This package included with some presenter classes that used for converting menu to html tag. By default the generated menu style is bootstrap navbar. But, there are also several different menu styles.

You can apply the menu style via ->style() method.

Or you can set which presenter to present the menu style via ->setPresenter() method.

You can also set which style of presenter when you rendering a menu.

The List of Available Menu Presenter Class

Name Presenter Class
navbar TysonLaravel\Menus\Presenters\Bootstrap\NavbarPresenter
navbar-right TysonLaravel\Menus\Presenters\Bootstrap\NavbarRightPresenter
nav-pills TysonLaravel\Menus\Presenters\Bootstrap\NavPillsPresenter
nav-tab TysonLaravel\Menus\Presenters\Bootstrap\NavTabPresenter
sidebar TysonLaravel\Menus\Presenters\Bootstrap\SidebarMenuPresenter
navmenu TysonLaravel\Menus\Presenters\Bootstrap\NavMenuPresenter

Make A Costum Presenter

You can create your own presenter class. Make sure your presenter is extends to TysonLaravel\Menus\Presenters\Presenter and implements to 'TysonLaravel\Menus\Presenters\PresenterInterface'.

For example, this is zurb-top-bar presenter.

To use this costum presenter, you can use the setPresenter method.

Register A New Menu Style

Menu style is like an alias to a presenter. You can register your style from your costum presenter in the configuration file in config/menus.php.

Now, you can use a style like this.

View Presenter

If you don't like to use presenter class, you use view presenter instead. We can set which view to present the menus by calling ->setView() method.

The List of Available View Presenter

View Name Menu Style
menus::default Bootstrap Navbar (default)
menus::navbar-left Bootstrap Navbar Left
menus::navbar-right Bootstrap Navbar Right
menus::nav-tabs Bootstrap Nav Tabs
menus::nav-tabs-justified Bootstrap Nav Tabs Justified
menus::nav-pills Bootstrap Nav Pills
menus::nav-pills-stacked Bootstrap Nav Pills Stacked
menus::nav-pills-justified Bootstrap Nav Pills Justified
menus::menu Plain Menu

Rendering Menu

To render the menu you can use render or get method.

You can also set which style to present the menu in the second parameter.

Or you may also set which view to present the menu.

The Menu Instance

Sometimes, maybe we need to add a new additional menu from controller or other place. To get an instance of an existing menu, you can use the instance method.

Finding Menu Item

To find menu item, you can use findBy method from TysonLaravel\Menus\MenuBuilder class.

You may also use whereTitle helper method to find a specific menu item. Also, you can add other child menu item in the callback that located in the second argument in whereTitle method.

Modifying Menu

After we create a menu, maybe we need to add other additional menus. You may modifying menu via ->modify method.

Set active in sub menu

Use ->subActive(['routeName'])


All versions of menus with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
ext-json Version *
laravel/framework Version ^9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sclaravel/menus contains the following files

Loading the files please wait ....