graham-campbell/navigation
最新稳定版本:v2.2.0
Composer 安装命令:
composer require graham-campbell/navigation
包简介
Navigation Is A Navigation Bar Generator For Laravel 5
关键字:
README 文档
README
Laravel Navigation was created by, and is maintained by Graham Campbell, and is a navigation bar generator for Laravel 5. Feel free to check out the releases, license, and contribution guidelines.
Installation
PHP 5.5+ or HHVM 3.6+, and Composer are required.
To get the latest version of Laravel Navigation, simply add the following line to the require block of your composer.json file:
"graham-campbell/navigation": "~2.2"
You'll then need to run composer install or composer update to download it and have the autoloader updated.
Once Laravel Navigation is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.
'GrahamCampbell\Navigation\NavigationServiceProvider'
You can register the Navigation facade in the aliases key of your config/app.php file if you like.
'Navigation' => 'GrahamCampbell\Navigation\Facades\Navigation'
Configuration
Laravel Navigation requires no configuration. Just follow the simple install instructions and go!
Usage
Navigation
This is the class of most interest. It is bound to the ioc container as 'navigation' and can be accessed using the Facades\Navigation facade. There are three public methods of interest.
The 'addToMain' and 'addToBar' methods will add the item to the internal main navigation array in the specified way. These methods both accept three arguments. All but the first are optional. The first argument must be an array. It must have either a 'slug' key or a 'url' key where the slug is the target url relative to the base url, and the url is a full url you may specify (useful to link to somewhere outside the application). It must also have a 'title' key which will specify the title, and you may also optionally add an 'icon' key which will at the relevant icon from font awesome to the mix. The second parameter specifies which navigation bar you want to add to. By default this is 'default', but you may have mutliple navigation bars, for example, Bootstrap CMS has an 'admin' navigation bar. The final parameter specifies if the item should be prepended to the internal array. By default this is false.
The third method is 'render', and accepts three arguments. All arguments are optional. The fist argument selects the main navigation bar you which to return. By default this is set to 'default'. The third argument selection the bar navigation bar you wish to return. By default this is set to false, where by no bar navigation is returned. You may set this to any string to return the relevant navigation bar. The final parameter is an array of variables you wish to pass to the navigation view. The default is ['title' => 'Navigation', 'side' => 'dropdown', 'inverse' => true].
Note that the navigation bar referred to as 'main' is the navigation bar that will go across the top of your page, and the navigation bar referred to as 'bar' is the navigation bar that will be a dropdown at the side. These are also referred to in the context of the default view provided with this package (for Twitter Bootstrap 3).
Also note that the render method will emit events so you can call the addTo methods lazily. The events emitted are 'navigation.main' and 'navigation.bar', which are emitted just before the render method starts to deal with the each navigation bar. The name of the selected navigation bar is also emitted. Check out the source.
Facades\Navigation
This facade will dynamically pass static method calls to the 'navigation' object in the ioc container which by default is the Navigation class.
NavigationServiceProvider
This class contains no public methods of interest. This class should be added to the providers array in config/app.php. This class will setup ioc bindings.
License
Laravel Navigation is licensed under The MIT License (MIT).
graham-campbell/navigation 适用场景与选型建议
graham-campbell/navigation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.94k 次下载、GitHub Stars 达 35, 最近一次更新时间为 2013 年 12 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「navigation」 「laravel」 「Graham Campbell」 「GrahamCampbell」 「navigation generator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 graham-campbell/navigation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 graham-campbell/navigation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 graham-campbell/navigation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
A block to display a list of links to child pages, or pages in current level
Laravel Menu management
Alfabank REST API integration
Create simple top navigation for laravel
GUI for monitoring usage in real-time for appui
统计信息
- 总下载量: 21.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 25
- 依赖项目数: 2
- 推荐数: 4
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-07