dlapps/sitemap-bundle
Composer 安装命令:
composer require dlapps/sitemap-bundle
包简介
Provides simple integration for generating sitemaps in Symfony 3.2+ projects
README 文档
README
The Sitemap bundle enables development teams to quickly add support for generating sitemaps, for their PHP7 packages and projects built on Symfony 3.2+.
The bundle supports a number of customisation parameters, PSR-4 autoloading, is PSR-2 compliant and has been well tested through automated tests, as well as being used in various microservices within the Dreamlabs ecosystem.
Install
Via Composer
$ composer require dreamlabs/sitemap-bundle
Enable the bundle in your AppKernel, present in: app/AppKernel.php.
$bundles = [ new DL\SitemapBundle\DLSitemapBundle(), ]
Usage
In order to generate a sitemap, you need to generate an instance of sitemap definition DL\SitemapBundle\Definition\Sitemap.
This instance can then accept the individual sitemap resources that you would like to add via the Sitemap::addResource() method.
In order to assist with the generation and validation of sitemap resources, the sitemap_resource_builder service is exposed, and can be used as in the example below:
$container->get('sitemap_resource_builder') ->withTitle($title) ->withAbsoluteLocation($location) ->withLastModified($lastModified) # \DateTime ->withChangeFrequency(ChangeFrequencyEnum::WEEKLY) ->withPriority(0.5) ->build();
The builder will automatically validate a new resource that is added to the Sitemap, and ensure that:
- All fields have been provided.
- The priority is a float between 0 and 1.
- The change frequency is a valid value.
- An absolute URL has been provided for the location.
The builder also exposes a ->withRelativeLocation($location) method, which can be used alongside the location_prefix configuration parameter in order to generate absolute routes, from relative URLs. This feature is present in order to assist with possibly mismatching hostnames when proxying through an improperly configured load balancer.
Given a scenarion in which the location_prefix parameter is set to https://example.com calling ->withRelativeLocation('/article/test') will generate the absolute URL https://example.com//article/test.
The DL\SitemapBundle\Enum\ChangeFrequencyEnum class can be used in order to define a strict change frequency. Possible values are:
- ChangeFrequencyEnum::ALWAYS
- ChangeFrequencyEnum::HOURLY
- ChangeFrequencyEnum::DAILY
- ChangeFrequencyEnum::WEEKLY
- ChangeFrequencyEnum::MONTHLY
- ChangeFrequencyEnum::YEARLY
- ChangeFrequencyEnum::NEVER
Configuration Reference
The following configuration parameters are also available for the bundle:
dl_sitemap: # The listener prefix, can be used in order to assist with the generation of absolute URLs from relative URLs. location_prefix: string # https://example.com
Testing
$ composer test
PSR-2 Compatibility
$ composer check-styles $ composer fix-styles
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email petre [at] dreamlabs.ro instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
dlapps/sitemap-bundle 适用场景与选型建议
dlapps/sitemap-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Sitemap」 「generation」 「sitemap.xml」 「dreamlabs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dlapps/sitemap-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dlapps/sitemap-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dlapps/sitemap-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Toolset for generating PHP code
Symfony sitemap generator
PHP Simple Sitemap Generator
Fabricates patterns.
PHP PDF library for generating and importing PDF documents. A component of the Pop PHP Framework
A simple website crawler & sitemap generator without a headless browser for Laravel 5.8+
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2017-01-08