kokspflanze/zfc-sitemap
Composer 安装命令:
composer require kokspflanze/zfc-sitemap
包简介
Sitemap module for Laminas, based on zend-navigation with eventmanager
README 文档
README
SYSTEM REQUIREMENTS
- requires PHP 7.1 or later; we recommend using the latest PHP version whenever possible.
- you have to use
laminas-navigation
INSTALLATION
Composer
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
php composer.phar require kokspflanze/zfc-sitemap
# (When asked for a version, type `dev-master`)
Go to config/application.config.php and add ZfcSitemap in the modules section.
How to use
Get the sitemap
you can see your current sitemap with /sitemap.xml
Create a sitemap as cache (optional)
This create a sitemap in data/zfc-sitemap as cache, this means, if you call /sitemap.xml it will not longer create a new sitemap, it will use the cached sitemap.
For this you need to install laminas/laminas-mvc-console and this directory data/zfc-sitemap with write rights.
Than you can execute php public/index.php generate-sitemap http://example.com to create your sitemap.
PS: You have to rerun it to create a new sitemap.
Change your sitemap
If you have dynamic pages on your page and you want to add them in the sitemap. You can add them with the EventManager.
Create a listener
create a new class
<?php namespace App\Core\Listener; use Laminas\EventManager; use Laminas\Navigation\AbstractContainer; use ZfcSitemap\Service\Sitemap; class SitemapCustom extends EventManager\AbstractListenerAggregate { /** * @inheritDoc */ public function attach(EventManager\EventManagerInterface $events, $priority = 1) { $this->listeners[] = $events->attach(Sitemap::EVENT_SITEMAP, [$this, 'onSiteMap'], $priority); } /** * @param EventManager\EventInterface $event */ public function onSiteMap(EventManager\EventInterface $event) { /** @var AbstractContainer $container */ $container = $event->getParam('container'); $container->addPage([ 'label' => 'Example', 'uri' => '/example', ]); /** * your custom stuff, add or remove pages */ $event->setParam('container', $container); } }
Than you have to add your listener in the service_manager config and in the following configuration.
'zfc-sitemap' => [ 'strategies' => [ Listener\SitemapCustom::class, ], ],
kokspflanze/zfc-sitemap 适用场景与选型建议
kokspflanze/zfc-sitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.2k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「Sitemap」 「navigation」 「zf」 「laminas」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kokspflanze/zfc-sitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kokspflanze/zfc-sitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kokspflanze/zfc-sitemap 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Symfony sitemap generator
A block to display a list of links to child pages, or pages in current level
PHP Simple Sitemap Generator
Interfaces for web resource models and services to retrieve and create them
Sitemap crawler/generator. For the given URL it will return sitemap XML file with URLs and images.
统计信息
- 总下载量: 1.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-23