Download the PHP package datlechin/filament-menu-builder without Composer

On this page you can find all versions of the php package datlechin/filament-menu-builder. 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 filament-menu-builder

Filament Menu Builder

Latest Version on Packagist Total Downloads

This Filament package allows you to create and manage menus in your Filament application.

Filament Menu Builder

[!NOTE] I created this for my personal project, so some features and extensibility are still lacking. Pull requests are welcome.

Installation

You can install the package via composer:

You need to publish the migrations and run them:

You can publish the config file with:

Optionally, if you want to customize the views, you can publish them with:

This is the contents of the published config file:

Add the plugin to AdminPanelProvider:

Usage

Adding locations

Locations are the places where you can display menus in the frontend. You can add locations in the AdminPanelProvider:

The first argument is the key of the location, and the second argument is the title of the location.

Alternatively, you may add locations using an array:

Setting up Menu Panels

Menu panels are the panels that contain the menu items which you can add to the menus.

Custom Link Menu Panel

By default, the package provides a Custom Link menu panel that allows you to add custom links to the menus.

Custom Link Menu Panel

The panel can be disabled by using the following when configuring the plugin, should you not need this functionality.

Custom Text Menu Panel

This package provides a Custom Text menu panel that allows you to add custom text items to the menus.

It is identical to the Custom Link menu panel except for the fact that you only set a title without a URL or target. This can be useful to add headers to mega-style menus.

The panel is disabled by default to prevent visual clutter. To enable the Custom Text menu panel, you can use the following when configuring the plugin.

Static Menu Panel

The static menu panel allows you to add menu items manually.

Similarily to locations, you may also add static menu items using an array:

Static Menu Panel

Model Menu Panel

The model menu panel allows you to add menu items from a model.

To create a model menu panel, your model must implement the \Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable interface and \Datlechin\FilamentMenuBuilder\Concerns\HasMenuPanel trait.

Then you must also implement the getMenuPanelTitleColumn and getMenuPanelUrlUsing methods. A complete example of this implementation is as follows:

Then you can add the model menu panel to the plugin:

Model Menu Panel

Additional Menu Panel Options

When registering a menu panel, multiple methods are available allowing you to configure the panel's behavior such as collapse state and pagination.

Custom Fields

In some cases, you may want to extend menu and menu items with custom fields. To do this, start by passing an array of form components to the addMenuFields and addMenuItemFields methods when registering the plugin:

Next, create a migration adding the additional columns to the appropriate tables:

Once done, simply run php artisan migrate.

Customizing the Resource

Out of the box, a default Menu Resource is registered with Filament when registering the plugin in the admin provider. This resource can be extended and overridden allowing for more fine-grained control.

Start by extending the Datlechin\FilamentMenuBuilder\Resources\MenuResource class in your application. Below is an example:

Now pass the custom resource to usingResource while registering the plugin with the panel:

Customizing the Models

The default models used by the plugin can be configured and overridden similarly to the plugin resource as seen above.

Simply extend the default models and then pass the classes when registering the plugin in the panel:

Using Menus

Getting the assigned menu for a registered location can be done using the Menu model. Below we will call the menu assigned to the primary location:

Menu items can be iterated from the menuItems relationship:

When a menu item is a parent, a collection of the child menu items will be available on the children property:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-menu-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.15.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 datlechin/filament-menu-builder contains the following files

Loading the files please wait ....