halloverden/symfony-route-deprecation-bundle
Composer 安装命令:
composer require halloverden/symfony-route-deprecation-bundle
包简介
The Route Deprecation Bundle provides tools to deprecate routes in your Symfony application. It implements the IETF draft of The Deprecation HTTP Header Field.
README 文档
README
The Route Deprecation Bundle provides tools to deprecate routes in your Symfony application. It implements the IETF draft of The Deprecation HTTP Header Field.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require halloverden/symfony-route-deprecation-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require halloverden/symfony-route-deprecation-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... HalloVerden\RouteDeprecationBundle\HalloVerdenRouteDeprecationBundle::class => ['all' => true], ];
Usage
You can deprecate any route with the DeprecatedRoute annotation.
since(required) - is astring ("yyyy-mm-dd")that defines the moment in which a route becomes deprecated. The headerDeprecationwill be set on the response, like so:Deprecation: @1672531200.sunset(optional) - is astring ("yyyy-mm-dd")that defines the moment in which a route becomes expired. The headerSunsetwill be set on the response, like so:Sunset: Mon, 01 Jun 2020 00:00:00 GMTenforce(optional) - is abooleanthat makes the route inaccessible after thesunsetdate (default isfalse). If you try to access a route where this option is set totrueand the current date is greater than thesunetdate, aGoneHttpExceptionis thrown.name(optional) - The name of the route to deprecate. If not specified, all routes (on that controller) will be deprecated.deprecationDateTimeFormat(optional) - The format of the date time used in the Deprecation header. default is@U(as per the IETF draft).sunsetDateTimeFormat(optional) - The format of the date time used in the Sunset header. default isD, d M Y H:i:s \G\M\T(as per the Sunset RFC)deprecationLink(optional) - The link used in theLinkheader for deprecation.sunsetLink- (optional) - The link used in theLinkheader for sunset.
you can also deprecate any route with route parameters.
Example using the attribute:
<?php namespace App\Controller; use HalloVerden\RouteDeprecationBundle\Attribute\DeprecatedRoute; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; #[Route(path: self::PATH, name: self::NAME, methods: ['GET'])] #[DeprecatedRoute(since: '2023-01-01')] class GetHealthzController extends BaseController { const PATH = '/healthz'; const NAME = 'healthz_get'; /** * @return Response */ public function __invoke(): Response { return new Response('ok'); } }
Example using route parameters in routes.yaml (you can also use xml, php and the route annotation):
# config/routes.yaml lol_healthz: path: /healthz controller: App\Controller\GetHealthzController defaults: _deprecated_since: '2024-01-01' _deprecated_sunset: '2024-02-01' _deprecated_enforce: false _deprecated_deprecation_date_time_format: '@U' _deprecated_sunset_date_time_format: 'D, d M Y H:i:s \G\M\T' _deprecated_deprecation_link: 'https://example.com/deprecation' _deprecated_sunset_link: 'https://example.com/sunset'
config options (optional):
hallo_verden_route_deprecation: deprecation: dateTimeFormat: '@U' link: 'https://example.com/deprecation' sunset: dateTimeFormat: 'D, d M Y H:i:s \G\M\T' link: 'https://example.com/sunset'
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
halloverden/symfony-route-deprecation-bundle 适用场景与选型建议
halloverden/symfony-route-deprecation-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.63k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「route」 「header」 「sunset」 「deprecation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 halloverden/symfony-route-deprecation-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 halloverden/symfony-route-deprecation-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 halloverden/symfony-route-deprecation-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
Write down your routing mapping at one place
A Laravel-like router for the WordPress Rewrite API
A Laravel helper to detect if the current route/path is active.
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 5.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-11