@@ -7,12 +7,12 @@ The BrowserKit Component
77
88 The BrowserKit component simulates the behavior of a web browser.
99
10- The BrowserKit component allows you to make web request , click on links and submit forms.
10+ The BrowserKit component allows you to make web requests , click on links and submit forms.
1111
1212Installation
1313------------
1414
15- You can install the component in 2 different ways:
15+ You can install the component in two different ways:
1616
1717* :doc: `Install it via Composer </components/using_components >` (``symfony/browser-kit `` on `Packagist `_);
1818* Use the official Git repository (https://github.com/symfony/BrowserKit).
@@ -21,13 +21,14 @@ Basic Usage
2121-----------
2222
2323.. note ::
24+
2425 The component only provides an abstract client and does not provide any "default" backend for the HTTP layer.
2526
2627Creating a Client
2728-----------------
2829
2930To create your own client you must extend the abstract client class and implement the doRequest method.
30- This method accepts a request and should return a response.
31+ This method accepts a requests and should return a response.
3132
3233.. code-block :: php
3334
@@ -36,8 +37,10 @@ This method accepts a request and should return a response.
3637 use Symfony\Component\BrowserKit\Client as BaseClient;
3738 use Symfony\Component\BrowserKit\Response;
3839
39- class Client extends BaseClient {
40- protected function doRequest($request) {
40+ class Client extends BaseClient
41+ {
42+ protected function doRequest($request)
43+ {
4144 // convert request into a response
4245 // ...
4346 return new Response($content, $status, $headers);
@@ -46,14 +49,14 @@ This method accepts a request and should return a response.
4649
4750 For a simple implementation of a browser based on an HTTP layer, have a look at Goutte _.
4851
49- For an implementation based on HttpKernelInterface, have a look at the Client provided by the :doc: `/components/http_kernel/introduction `.
52+ For an implementation based on `` HttpKernelInterface `` , have a look at the Client provided by the :doc: `/components/http_kernel/introduction `.
5053
5154
52- Making Request
55+ Making Requests
5356~~~~~~~~~~~~~~
5457
55- To make a request you use the client's request method.
56- The first two arguments are for the HTTP method and the request url .
58+ To make a request you use the client's request _ method.
59+ The first two arguments are for the HTTP method and the request URL .
5760The request method will return a crawler object.
5861
5962.. code-block :: php
@@ -66,7 +69,7 @@ The request method will return a crawler object.
6669 Clicking Links
6770~~~~~~~~~~~~~~
6871
69- Select a link with the crawler and pass it to the click method to click on the link.
72+ Select a link with the crawler and pass it to the click _ method to click on the link.
7073
7174.. code-block :: php
7275
@@ -195,7 +198,7 @@ You can define create cookies and add them to a cookie jar that can be injected
195198 History
196199-------
197200
198- The client stores all your request allowing you to go back and forward in your history.
201+ The client stores all your requests allowing you to go back and forward in your history.
199202
200203.. code-block :: php
201204
@@ -215,7 +218,7 @@ The client stores all your request allowing you to go back and forward in your h
215218 // go forward to documentation page
216219 $doc_crawler = $client->forward();
217220
218- You can restart the clients history with the restart method. This will also clear out the CookieJar.
221+ You can restart the client's history with the restart method. This will also clear out the CookieJar.
219222
220223.. code-block :: php
221224
@@ -230,4 +233,6 @@ You can restart the clients history with the restart method. This will also clea
230233
231234
232235 .. _Packagist : https://packagist.org/packages/symfony/browser-kit
233- .. _Goutte : https://github.com/fabpot/Goutte
236+ .. _Goutte : https://github.com/fabpot/Goutte
237+ .. _request : http://api.symfony.com/2.3/Symfony/Component/BrowserKit/Client.html#method_request
238+ .. _click : http://api.symfony.com/2.3/Symfony/Component/BrowserKit/Client.html#method_click
0 commit comments