Skip to content

Commit 23ddd7d

Browse files
committed
minor #12871 Replace references to Goutte with HttpBrowser (HypeMC)
This PR was merged into the 4.3 branch. Discussion ---------- Replace references to Goutte with HttpBrowser With the introduction of [HttpBrowser](symfony/symfony#30602) there's no need for Goutte any more, but the docs currently mention both, which is a little bit confusing. Also, the current version of Goutte actuality [extends HttpBrowser](https://github.com/FriendsOfPHP/Goutte/blob/v4.0.0/Goutte/Client.php), but doesn't add any functionality to it. It seems to me that Goutte is being completely replaced with HttpBrowser so there's no point in mentioning it in the docs any more. Commits ------- 50898ae Replace references to Goutte with HttpBrowser
2 parents 5a8794d + 50898ae commit 23ddd7d

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

components/browser_kit.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ This method accepts a request and should return a response::
5959
}
6060

6161
For a simple implementation of a browser based on the HTTP layer, have a look
62-
at `Goutte`_. For an implementation based on ``HttpKernelInterface``, have
63-
a look at the :class:`Symfony\\Component\\HttpKernel\\Client` provided by
64-
the :doc:`HttpKernel component </components/http_kernel>`.
62+
at the :class:`Symfony\\Component\\BrowserKit\\HttpBrowser` provided by
63+
:ref:`this component <component-browserkit-external-requests>`. For an implementation based
64+
on ``HttpKernelInterface``, have a look at the :class:`Symfony\\Component\\HttpKernel\\Client`
65+
provided by the :doc:`HttpKernel component </components/http_kernel>`.
6566

6667
Making Requests
6768
~~~~~~~~~~~~~~~

components/dom_crawler.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -581,23 +581,26 @@ of the information you need to create a POST request for the form::
581581

582582
// now use some HTTP client and post using this information
583583

584-
One great example of an integrated system that uses all of this is `Goutte`_.
585-
Goutte understands the Symfony Crawler object and can use it to submit forms
584+
One great example of an integrated system that uses all of this is
585+
the :class:`Symfony\\Component\\BrowserKit\\HttpBrowser` provided by
586+
the :doc:`BrowserKit component </components/browser_kit>`.
587+
It understands the Symfony Crawler object and can use it to submit forms
586588
directly::
587589

588-
use Goutte\Client;
590+
use Symfony\Component\BrowserKit\HttpBrowser;
591+
use Symfony\Component\HttpClient\HttpClient;
589592

590593
// makes a real request to an external site
591-
$client = new Client();
592-
$crawler = $client->request('GET', 'https://github.com/login');
594+
$browser = new HttpBrowser(HttpClient::create());
595+
$crawler = $browser->request('GET', 'https://github.com/login');
593596

594597
// select the form and fill in some values
595598
$form = $crawler->selectButton('Sign in')->form();
596599
$form['login'] = 'symfonyfan';
597600
$form['password'] = 'anypass';
598601

599602
// submits the given form
600-
$crawler = $client->submit($form);
603+
$crawler = $browser->submit($form);
601604

602605
.. _components-dom-crawler-invalid:
603606

@@ -622,5 +625,4 @@ Learn more
622625
* :doc:`/testing`
623626
* :doc:`/components/css_selector`
624627

625-
.. _`Goutte`: https://github.com/FriendsOfPHP/Goutte
626628
.. _`html5-php library`: https://github.com/Masterminds/html5-php

0 commit comments

Comments
 (0)