Download the PHP package hoangphison/menu without Composer
On this page you can find all versions of the php package hoangphison/menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hoangphison/menu
More information about hoangphison/menu
Files in hoangphison/menu
Package menu
Short Description Html menu generator
License MIT
Homepage https://github.com/hoangphison/menu
Informations about the package menu
Html Menu Generator
The hoangphison/menu
package provides a fluent interface to build menus of any size in your php application. If you're building your app with Laravel, the hoangphison/laravel-menu
provides some extra treats.
Documentation is available at https://docs.spatie.be/menu.
Upgrading from version 1? There's a guide for that!
Human Readable, Fluent Interface
All classes provide a human readable, fluent interface (no array configuration). Additionally, you can opt for a more verbose and flexible syntax, or for convenience methods that cover most use cases.
Or a More Programmatic Approach
Menus can also be created through a reduce-like callable.
Strong Control Over the Html Output
You can programatically add html classes and attributes to any item in the menu, or to the menu itself.
Not Afraid of Depths
The menu supports submenus, which in turn can be nested infinitely.
Some Extra Treats for Laravel Apps
The Laravel version of the menu package adds some extras like convenience methods for generating URLs and macros.
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Install
You can install the package via composer:
Usage
Documentation is available at https://docs.spatie.be/menu.
Upgrading to 2.0
Upgrading to 2.0 should be pretty painless for most use cases.
If you're just building menus...
- The
void
andvoidIf
have been removed. These can be replaced byhtml
andhtmlIf
, with empty strings as their first arguments - The
prefixLinks
andprefixUrls
methods have been removed because they were too unpredictable in some case. There currently isn't an alternative for these, besides writing your own logic and applying it withapplyToAll
.
If you're using custom Item
implementations...
- The
HtmlAttributes
andParentAttributes
traits have been renamed toHasHtmlAttributes
andHasParentAttributes
. - The
HasUrl
interface and trait has been removed. Url-related methods now also are part of theActivatable
interface and trait.
New features...
- Added the static
Menu::build
and non-staticMenu::fill
methods to create menu's from arrays. - The
setActive
method onActivatable
now also accepts a non-strict boolean or callable parameter to set$active
to true or false. Menu::html
andMenu::htmlIf
now accept a$parentAttributes
array as their second arguments.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Postcardware
You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
We publish all received postcards on our company website.
Credits
- Sebastian De Deyne
- All Contributors
Support us
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
License
The MIT License (MIT). Please see License File for more information.