Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add docs for the WebLink component#10309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 9 commits intosymfony:3.4fromdunglas:weblink
Oct 30, 2018
Merged

Conversation

@dunglas
Copy link
Member

@dunglasdunglas commentedSep 10, 2018
edited
Loading

The WebLink component is available since Symfony 3.3, but I never took the time to add the docs (however, a blog post explaining how to use it was available).

This documentation is based onhttps://dunglas.fr/2017/10/symfony-4-http2-push-and-preloading/.
If necessary, I can grant any copyright regarding this post to the Symfony project.

symfony/symfony#21478
symfony/symfony#22273
Closes#7515.

ping-localhost reacted with hooray emoji
@dunglas
Copy link
MemberAuthor

dunglas commentedSep 10, 2018
edited
Loading

Do you know how to fix this (cryptic) RST error?https://travis-ci.org/symfony/symfony-docs/builds/426930279

@xabbuhxabbuh added this to the3.4 milestoneSep 11, 2018
@javiereguiluz
Copy link
Member

About the RST issue, you must use this alternative format for the link of the line 64:

`Bootstrap`_

@xabbuh
Copy link
Member

looks like the failure was related to some whitespace issues (see38fda88)

@dunglas
Copy link
MemberAuthor

Thanks a lot@xabbuh!

xabbuh reacted with thumbs up emoji

weblink.rst Outdated
brings great opportunities to boost webapp's performance.

Thanks to WebLink, HTTP/2 (**h2**) servers are able to push resources to clients
before they even know that they need them (think to CSS or JavaScript

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

think about

weblink.rst Outdated
Thanks to WebLink, HTTP/2 (**h2**) servers are able to push resources to clients
before they even know that they need them (think to CSS or JavaScript
files, or relations of an API resource). WebLink also enables other very
efficient optimisations that work with HTTP 1:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

HTTP 1.x or 1.1?

weblink.rst Outdated

- telling the browser to fetch or to render another webpage in the
background ;
- init early DNS lookups, TCP handshakes or TLS negotiations

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

initializing

weblink.rst Outdated
background ;
- init early DNS lookups, TCP handshakes or TLS negotiations

Let's discover how easy it is to use it and the real life benefits you

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd suggest removing this sentence

weblink.rst Outdated
Let's discover how easy it is to use it and the real life benefits you
can expect.

To benefit from HTTP/2 Server Pushes, a HTTP/2 server and a HTTPS connection

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

s/a/an

weblink.rst Outdated
_controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction'
template: 'homepage.html.twig'

Refresh your browser, this nice homepage should appear:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

s/nice//

weblink.rst Outdated

.. note::

Google Chrome provides a nice interface to debug HTTP/2 connections.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

s/nice//

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Afterwards s/a nice interface/an interface/

weblink.rst Outdated
How does it works?
~~~~~~~~~~~~~~~~~~

The WebLink component tracks Link HTTP headers to add to the response.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

missing backticks around Link

weblink.rst Outdated
.. image:: /_images/components/weblink/response-headers.png

According to `the Preload specification`_,
when a HTTP/2 server detects that the original (HTTP 1) response

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

an HTTP + HTTP 1.x

weblink.rst Outdated
browsers.

In addition to HTTP/2 Push and preloading, the WebLink component also
provide some helpers to send `Resource

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

provides

@OskarStark
Copy link
Contributor

Hey@dunglas,

you mention some twig helpers in your blog post, but they are not included in the component itself, is a bridge or anything else available? Or am I missing sth?

@dunglas
Copy link
MemberAuthor

Yes, they belong in the TwigBridge.

@dunglas
Copy link
MemberAuthor

Than you very much@nicolas-grekas, changes applied.

symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestOct 24, 2018
…k() (dunglas)This PR was squashed before being merged into the 4.2-dev branch (closes #28875).Discussion----------[FWBundle] Add a new method AbstractController::addLink()| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      |no| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | todoThis provides a convenient method to add `Link` headers to the current `Response` directly from the `Request` object.It improves the developer experience and the discoverability of [the WebLink component](symfony/symfony-docs#10309).Usage:```phpnamespace App\Controller;use Fig\Link\Link;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;class MyAction extends AbstractController{    public function __invoke(Request $request): Response    {        $this->addLink($request, new Link('mercure', 'https://demo.mercure.rocks'));        return $this->json(['foo' => 'bar']);    }}```Commits-------4d20c39f70 [FWBundle] Add a new method AbstractController::addLink()
fabpot added a commit to symfony/symfony that referenced this pull requestOct 24, 2018
…k() (dunglas)This PR was squashed before being merged into the 4.2-dev branch (closes#28875).Discussion----------[FWBundle] Add a new method AbstractController::addLink()| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      |no| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | todoThis provides a convenient method to add `Link` headers to the current `Response` directly from the `Request` object.It improves the developer experience and the discoverability of [the WebLink component](symfony/symfony-docs#10309).Usage:```phpnamespace App\Controller;use Fig\Link\Link;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;class MyAction extends AbstractController{    public function __invoke(Request $request): Response    {        $this->addLink($request, new Link('mercure', 'https://demo.mercure.rocks'));        return $this->json(['foo' => 'bar']);    }}```Commits-------4d20c39 [FWBundle] Add a new method AbstractController::addLink()
@javiereguiluzjaviereguiluz merged commit91ee3bc intosymfony:3.4Oct 30, 2018
javiereguiluz added a commit that referenced this pull requestOct 30, 2018
This PR was merged into the 3.4 branch.Discussion----------Add docs for the WebLink componentThe WebLink component is available since Symfony 3.3, but I never took the time to add the docs (however, a blog post explaining how to use it was available).This documentation is based onhttps://dunglas.fr/2017/10/symfony-4-http2-push-and-preloading/.If necessary, I can grant any copyright regarding this post to the Symfony project.symfony/symfony#21478symfony/symfony#22273Closes#7515.Commits-------91ee3bc Fix RSTea7b3da@nicolas-grekas' review38fda88 fix builde12e776 RST088690f Fix linke3d4036 RST178821e refactor9f4ae9b fix typo6beb4eb Add docs for the WebLink component
@javiereguiluz
Copy link
Member

Thanks Kévin for contributing this doc (and the component too!). I made some changes while merging, specially on the mainweblink.rst article. Instead of a self-contained tutorial that installs Bootstrap, creates a new Symfony project, etc. I streamlined to assume that you already have a working Symfony app so we can focus the explanation on the preloading and resource hints features. Thanks!

OskarStark reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@OskarStarkOskarStarkOskarStark left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@dunglas@javiereguiluz@xabbuh@OskarStark@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp