baraja-core/sitemap
Composer 安装命令:
composer require baraja-core/sitemap
包简介
README 文档
README
Simple sitemap generator with robust and performance implementation.
- Generates a standardized site map in XML format,
- Allows custom implementation of UrlLoader and specification of custom link sources,
- The generated map is automatically cached and updated without the need to use cron.
📦 Installation
It's best to use Composer for installation, and you can also find the package on Packagist and GitHub.
To install, simply use the command:
$ composer require baraja-core/sitemap
You can use the package manually by creating an instance of the internal classes, or register a DIC extension to link the services directly to the Nette Framework.
Basic description
The package automatically generates a site map as a sitemap.xml file with the following structure:
<urlset xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc> https://... // Here will be the whole absolute path </loc> <changefreq>weekly</changefreq> <priority>0.5</priority> </url> </urlset>
URLs are retrieved from the abstract SitemapUrlLoader service, which can be overloaded and otherwise implemented. UrlLoader returns the entity field SitemapItems[] with the getUrls() method.
It adds its own presenter to the administration, which shows the current form and structure of the file.
Installation
Composer:
$ composer require baraja-core/sitemap
The routing rule and services are registered automatically.
After installation, you must define an UrlLoader in the package, which gets a list of all available URLs and passes it on for rendering. You can use another existing library as the UrlLoader.
Getting a list of URLs
The package does not include the default implementation of UrlLoader, and each project must implement it itself.
The class must contain a public getUrls() method that returns an array of SitemapItem[] instances.
Getting sitemap + cache
The package does not create any physical sitemap file, because it runs a PHP script with each request. In order not to always have to perform complex mapping, the package itself will use a cache with a default validity of 5 minutes.
The cache length setting can be affected by the neon configuration file:
sitemap: cacheExpirationTime: '20 minutes'
📄 License
baraja-core/sitemap is licensed under the MIT license. See the LICENSE file for more details.
baraja-core/sitemap 适用场景与选型建议
baraja-core/sitemap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.02k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 baraja-core/sitemap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 baraja-core/sitemap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-09-27