下开发 / http-headers-bundle
为 Symfony 定制的响应 HTTP 头定义
v1.1.0
2015-11-18 20:14 UTC
Requires
- php: ^5.3.3|^7.0
- symfony/config: ^2.2.3|^3.0
- symfony/dependency-injection: ^2.2.3|^3.0
- symfony/event-dispatcher: ^2.2.3|^3.0
- symfony/http-kernel: ^2.2.3|^3.0
This package is not auto-updated.
Last update: 2024-09-21 01:08:33 UTC
README
为 Symfony2 定制的 HTTP 头
安装 HttpHeadersBundle
您需要将依赖行添加到您的 composer.json
文件中
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
...
"mmoreram/http-headers-bundle": "dev-master"
},
然后您需要使用 composer 更新您的项目依赖项
php composer.phar update
并在您的 appkernel.php 文件中注册该包
return array(
// ...
new Mmoreram\HttpHeadersBundle\HttpHeadersBundle(),
// ...
);
配置 HttpHeaders Bundle
现在您可以为您的项目配置任意数量的 HTTP 头。您只需在您的 config.yml
文件中给出它们的名称和值即可
http_headers:
response:
x_jedi_newton:
name: X-Jedi-Newton
values:
- I can calculate the motion of heavenly bodies, but not the madness of people
- Errors are not in the art but in the artificers
- It is the weight, not numbers of experiments that is to be regarded
x_jedi:
name: X-Jedi
values:
- Meet our team at humans.txt
此包将在每个请求中获取一个随机引语。如果只定义了一个引语,则只输出此引语。
加入 X-Jedi
有一个名为 X-Jedi 的项目,鼓励所有开发团队在 X-Jedi 的名称下添加自己的 http-headers,并附上他们最具代表性的引语。您可以在 X-Jedi 项目 网页上找到更多信息。