b13/justincase
Composer 安装命令:
composer require b13/justincase
包简介
With incoming URLs, it does not matter if they are upper/lowercase, they just work.
README 文档
README
When your marketing team has accidentally pushed a campaign with mixed case URLs, they should not run into 404s.
This TYPO3 extension solves your pain - just in case.
What does it do?
By default, TYPO3 v9 is strict when you're actual page is called https://b13.com/lets-connect but your marketing
dudes name it https://b13.com/Lets-Connect. TYPO3 v9 saves URLs as lower-case by default.
A simple PSR-15 based middleware transforms your incoming URL into lower-case and you should be fine, as both URLs would work for the users.
Installation
Use it via composer req b13/justincase or install the Extension justincase from the TYPO3 Extension Repository.
justincase requires TYPO3 v9.5.0 or later.
Configuration
As a web developer, sometimes the team wants a 307 redirect, and sometimes to just work as everything would be lower-case.
justincase does the latter ("just pretend it works") and receives the URL, processes the URL further by default, however you can configure the extension on a per-site basis to do redirects instead, by modifying the Languages array of the site configuration yaml:
languages:
-
title: English
...
redirectOnUpperCase: true
# in case you want to use a status code, other than 307
redirectStatusCode: 303
If you wish to enable redirect for all languages, add these lines at the bottom of the site configuration yaml instead:
settings:
redirectOnUpperCase: true
# in case you want to use a status code, other than 307
redirectStatusCode: 303
Please note that this option only works for GET or HEAD requests.
Events
a BeforeMiddlewareIsAppliedEvent is fired before LowerCaseUri Middleware is applied.
you can prevent applying Middleware by calling event->doNotApply
Caveats
If specific route enhancers check on camel-case (e.g. {order}/paymentForm/) this might lead to unexpected behaviours
and 404 pages.
License
As TYPO3 Core, justincase is licensed under GPL2 or later. See the LICENSE file for more details.
Background, Credits & Further Maintenance
This extension was created as a show-case on what you can do with middlewares for TYPO3 v9 and customize so many things. See https://forge.typo3.org/issues/87544 for the initial request.
TYPO3 community often requests functionality, which can be put in small and efficient extensions, and justincase does exactly that, without having to burden everything into TYPO3 Core.
justincase was initially created by Daniel Goerz and Benni Mack for b13, Stuttgart, with the nice support from Matthias Stegmann for providing the extension name.
Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.
b13/justincase 适用场景与选型建议
b13/justincase 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 235.8k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2019 年 07 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 b13/justincase 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 b13/justincase 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 235.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2019-07-24