6d77cdfd65
This PR was squashed before being merged into the 3.3-dev branch (closes #21478).
Discussion
----------
[Asset] Add support for preloading with links and HTTP/2 push
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | todo
Allows compatible clients to preload mandatory assets like scripts, stylesheets or images according to [the "preload" working draft of the W3C](https://www.w3.org/TR/preload/).
Thanks to this PR, Symfony will automatically adds `Link` HTTP headers with a `preload` relation for mandatory assets. If an intermediate proxy supports HTTP/2 push, it will convert preload headers. For instance [Cloudflare supports this feature](https://blog.cloudflare.com/using-http-2-server-push-with-php/).
It dramatically increases pages speed and make the web greener because only one TCP connection is used to fetch all mandatory assets (decrease servers and devices loads, improve battery lives).
Usage:
Updated version:
```html
<html>
<body>
Hello
<script src="{{ preload(asset('/scripts/foo.js'), 'script') }}"></script>
</body>
</html>
```
~~First proposal:~~
```html
<html>
<body>
Hello
<script src="{{ preloaded_asset('/scripts/foo.js', 'script') }}"></script>
</body>
</html>
```
- [x] Add tests
Commits
-------
7bab21700d
[Asset] Add support for preloading with links and HTTP/2 push
92 lines
3.1 KiB
JSON
92 lines
3.1 KiB
JSON
{
|
|
"name": "symfony/framework-bundle",
|
|
"type": "symfony-bundle",
|
|
"description": "Symfony FrameworkBundle",
|
|
"keywords": [],
|
|
"homepage": "https://symfony.com",
|
|
"license": "MIT",
|
|
"authors": [
|
|
{
|
|
"name": "Fabien Potencier",
|
|
"email": "fabien@symfony.com"
|
|
},
|
|
{
|
|
"name": "Symfony Community",
|
|
"homepage": "https://symfony.com/contributors"
|
|
}
|
|
],
|
|
"require": {
|
|
"php": ">=5.5.9",
|
|
"symfony/cache": "~3.3",
|
|
"symfony/class-loader": "~3.2",
|
|
"symfony/dependency-injection": "~3.3",
|
|
"symfony/config": "~3.3",
|
|
"symfony/event-dispatcher": "~3.3",
|
|
"symfony/http-foundation": "~3.3",
|
|
"symfony/http-kernel": "~3.3",
|
|
"symfony/polyfill-mbstring": "~1.0",
|
|
"symfony/filesystem": "~2.8|~3.0",
|
|
"symfony/finder": "~2.8|~3.0",
|
|
"symfony/routing": "~3.1.10|^3.2.3",
|
|
"symfony/security-core": "~2.8|~3.0",
|
|
"symfony/security-csrf": "~2.8|~3.0",
|
|
"symfony/stopwatch": "~2.8|~3.0",
|
|
"doctrine/cache": "~1.0"
|
|
},
|
|
"require-dev": {
|
|
"symfony/asset": "~2.8|~3.0",
|
|
"symfony/browser-kit": "~2.8|~3.0",
|
|
"symfony/console": "~3.3",
|
|
"symfony/css-selector": "~2.8|~3.0",
|
|
"symfony/dom-crawler": "~2.8|~3.0",
|
|
"symfony/polyfill-intl-icu": "~1.0",
|
|
"symfony/security": "~2.8|~3.0",
|
|
"symfony/form": "~3.3",
|
|
"symfony/expression-language": "~2.8|~3.0",
|
|
"symfony/process": "~2.8|~3.0",
|
|
"symfony/security-core": "~3.2",
|
|
"symfony/security-csrf": "~2.8|~3.0",
|
|
"symfony/serializer": "~3.3",
|
|
"symfony/translation": "~2.8|~3.0",
|
|
"symfony/templating": "~2.8|~3.0",
|
|
"symfony/validator": "~3.2",
|
|
"symfony/yaml": "~3.2",
|
|
"symfony/property-info": "~3.3",
|
|
"doctrine/annotations": "~1.0",
|
|
"phpdocumentor/reflection-docblock": "^3.0",
|
|
"twig/twig": "~1.26|~2.0",
|
|
"sensio/framework-extra-bundle": "^3.0.2"
|
|
},
|
|
"conflict": {
|
|
"phpdocumentor/reflection-docblock": "<3.0",
|
|
"phpdocumentor/type-resolver": "<0.2.0",
|
|
"symfony/asset": "<3.3",
|
|
"symfony/console": "<3.3",
|
|
"symfony/serializer": "<3.3",
|
|
"symfony/form": "<3.3",
|
|
"symfony/property-info": "<3.3"
|
|
},
|
|
"suggest": {
|
|
"ext-apcu": "For best performance of the system caches",
|
|
"symfony/console": "For using the console commands",
|
|
"symfony/form": "For using forms",
|
|
"symfony/serializer": "For using the serializer service",
|
|
"symfony/validator": "For using validation",
|
|
"symfony/yaml": "For using the debug:config and lint:yaml commands",
|
|
"symfony/property-info": "For using the property_info service",
|
|
"symfony/process": "For using the server:run, server:start, server:stop, and server:status commands"
|
|
},
|
|
"autoload": {
|
|
"psr-4": { "Symfony\\Bundle\\FrameworkBundle\\": "" },
|
|
"exclude-from-classmap": [
|
|
"/Tests/"
|
|
]
|
|
},
|
|
"minimum-stability": "dev",
|
|
"extra": {
|
|
"branch-alias": {
|
|
"dev-master": "3.3-dev"
|
|
}
|
|
}
|
|
}
|