定制 kodicomponents/navigation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kodicomponents/navigation

Composer 安装命令:

composer require kodicomponents/navigation

包简介

The KodiCMS Support package.

README 文档

README

Installation

  1. Require this package in your composer.json and run composer update:

    composer require kodicomponents/navigation

  2. After composer update, insert service provider KodiComponents\Navigation\NavigationServiceProvider::class, before Application Service Providers... to the config/app.php

Example

	...
	/*
	 * Navigation Service Provider
	 */
	KodiComponents\Navigation\NavigationServiceProvider::class,
	
	/*
	 * Application Service Providers...
	 */
	App\Providers\AppServiceProvider::class,
	...

Using

$navigation = new \KodiComponents\Navigation\Navigation([
	[
		'title' => 'Test',
		'icon' => 'fa fa-user',
		'priority' => 500,
		'url' => 'http://site.com',
		'pages' => [
			[
				'title' => 'Test3',
				'icon' => 'fa fa-user',
				'url' => 'http://site.com',
			],
		],
	],
	[
		'title' => 'Test1',
		'icon' => 'fa fa-user',
		'priority' => 600,
		'url' => 'http://site.com',
	],
]);


// Setting pages from array 
$navigation->setFromArray([
	[
		'title' => 'Test',
		'icon' => 'fa fa-user',
		'priority' => 500,
		'url' => 'http://site.com',
		'pages' => [
			[
				'title' => 'Test3',
				'icon' => 'fa fa-user',
				'url' => 'http://site.com',
			],
		],
	],
	[
		'title' => 'Test1',
		'icon' => 'fa fa-user',
		'priority' => 600,
		'url' => 'http://site.com',
	],
]);


// Setting page with method addPage(array|string|\KodiComponents\Navigation\Contracts\PageInterface)

$newPage = $navigation->addPage('New page');
$subPage = $newPage->addPage('Sub page');

$subPage->setPages(function(PageInterface $page) {
	$page->addPage(...);
	$page->addPage(...);
	
	$page->addPage(...)->setPages(function(PageInterface $page) {
		...
	});
});

$page = new \KodiComponents\Navigation\Page();

$page->setTitle(...);
$page->setIcon(...);
$page->setId(...);

$subPage1 = $newPage->addPage($page);

$navigation->getPages()->push($page);

$navigation->getPages()->prepend($page);

// Child pages
$page->getPages(); // Get sub pages
$navigation->getPages(); // Navigation pages

// Count pages
$navigation->countPages();

// Get first page
$page = $navigation->getPages()->first();

// get sub pages
$page->getPages(); // return KodiComponents\Navigation\PageCollection

// Count sub pages
$page->countPages();

// get parent page
$page->getParent();

// check if page has child
$page->hasChild();
$page->isChildOf($navigation);

// get title
$page->getTitle();

// get icon
$page->getIcon();

// get id
$page->getId();

// get utl
$page->getUrl();

// get path
$page->getPath(); // return array ['first page title', 'second page title', 'current page']

// get priority
$page->getPriority();

// check is active
$page->isActive();

// to array
$navigation->toArray();
$page->toArray();

Searching

// by path
$navigation->getPages()->findByPath('Page 1/Page 2/Page 3');

// or for page
$page->getPages()->findByPath('Page 1/Page 2/Page 3');


// by id

$page = new \KodiComponents\Navigation\Page();
$page->setId('page_id');

$navigation->addPage($page);
$navigation->getPages()->findById('page_id'); // return Page | null

$subPage = $navigation->addPage('Test page without id');
$subPage->addPage('Test subpage without id');

$navigation->getPages()->findById(md5('Test page without id/Test subpage without id'));

kodicomponents/navigation 适用场景与选型建议

kodicomponents/navigation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 239.89k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2016 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「menu」 「navigation」 「laravel」 「kodicms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kodicomponents/navigation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kodicomponents/navigation 我们能提供哪些服务?
定制开发 / 二次开发

基于 kodicomponents/navigation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 239.89k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 12
  • 依赖项目数: 10
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-24