class Client extends Client
Client simulates a browser and makes requests to a Kernel object.
| protected | $history | from Client | |
| protected | $cookieJar | from Client | |
| protected | $server | from Client | |
| protected | $internalRequest | from Client | |
| protected | $request | from Client | |
| protected | $internalResponse | from Client | |
| protected | $response | from Client | |
| protected | $crawler | from Client | |
| protected | $insulated | from Client | |
| protected | $redirect | from Client | |
| protected | $followRedirects | from Client | |
| protected | $kernel |
| __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) | ||
| followRedirects(bool $followRedirect = true) Sets whether to automatically follow redirects or not. | from Client | |
| bool | isFollowingRedirects() Returns whether client automatically follows redirects or not. | from Client |
| setMaxRedirects(int $maxRedirects) Sets the maximum number of redirects that crawler can follow. | from Client | |
| int | getMaxRedirects() Returns the maximum number of redirects that crawler can follow. | from Client |
| insulate(bool $insulated = true) Sets the insulated flag. | from Client | |
| setServerParameters(array $server) Sets server parameters. | from Client | |
| setServerParameter(string $key, string $value) Sets single server parameter. | from Client | |
| string | getServerParameter(string $key, string $default = '') Gets single server parameter for specified key. | from Client |
| Crawler | xmlHttpRequest(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true) | from Client |
| History | getHistory() Returns the History instance. | from Client |
| CookieJar | getCookieJar() Returns the CookieJar instance. | from Client |
| Crawler | getCrawler() Returns the current Crawler instance. | from Client |
| Response | getInternalResponse() Returns the current BrowserKit Response instance. | from Client |
| Response | getResponse() A Response instance | |
| Request | getInternalRequest() Returns the current BrowserKit Request instance. | from Client |
| Request | getRequest() A Request instance | |
| Crawler | click(Link $link) Clicks on a given link. | from Client |
| Crawler | submit(Form $form, array $values = array()) Submits a form. | from Client |
| Crawler | request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true) Calls a URI. | from Client |
| object | doRequestInProcess(object $request) Makes a request in another process. | from Client |
| object | doRequest(object $request) Makes a request. | |
| getScript(object $request) Returns the script to execute when the request must be insulated. | ||
| object | filterRequest(Request $request) Converts the BrowserKit request to a HttpKernel request. | |
| Response | filterResponse(object $response) Converts the HttpKernel response to a BrowserKit response. | |
| Crawler|null | createCrawlerFromContent(string $uri, string $content, string $type) Creates a crawler. | from Client |
| Crawler | back() Goes back in the browser history. | from Client |
| Crawler | forward() Goes forward in the browser history. | from Client |
| Crawler | reload() Reloads the current browser. | from Client |
| Crawler | followRedirect() Follow redirects? | from Client |
| restart() Restarts the client. | from Client | |
| string | getAbsoluteUri(string $uri) Takes a URI and converts it to absolute if it is not already absolute. | from Client |
| Crawler | requestFromRequest(Request $request, bool $changeHistory = true) Makes a request from a Request object directly. | from Client |
| catchExceptions(bool $catchExceptions) Sets whether to catch exceptions when the kernel is handling a request. | ||
| getHandleScript() | ||
| array | filterFiles(array $files) Filters an array of files. |
| HttpKernelInterface | $kernel | An HttpKernel instance |
| array | $server | The server parameters (equivalent of $_SERVER) |
| History | $history | A History instance to store the browser history |
| CookieJar | $cookieJar | A CookieJar instance to store the cookies |
Sets whether to automatically follow redirects or not.
| bool | $followRedirect | Whether to follow redirects |
Returns whether client automatically follows redirects or not.
| bool |
Sets the maximum number of redirects that crawler can follow.
| int | $maxRedirects |
Returns the maximum number of redirects that crawler can follow.
| int |
Sets the insulated flag.
| bool | $insulated | Whether to insulate the requests or not |
| RuntimeException | When Symfony Process Component is not installed |
Sets server parameters.
| array | $server | An array of server parameters |
Sets single server parameter.
| string | $key | A key of the parameter |
| string | $value | A value of the parameter |
Gets single server parameter for specified key.
| string | $key | A key of the parameter to get |
| string | $default | A default value when key is undefined |
| string | A value of the parameter |
| string | $method | |
| string | $uri | |
| array | $parameters | |
| array | $files | |
| array | $server | |
| string | $content | |
| bool | $changeHistory |
| Crawler |
Returns the History instance.
| History | A History instance |
Returns the CookieJar instance.
| CookieJar | A CookieJar instance |
Returns the current Crawler instance.
| Crawler | A Crawler instance |
Returns the current BrowserKit Response instance.
| Response | A BrowserKit Response instance |
A Response instance
| Response |
Returns the current BrowserKit Request instance.
| Request | A BrowserKit Request instance |
A Request instance
| Request |
Clicks on a given link.
| Link | $link |
| Crawler |
Submits a form.
| Form | $form | |
| array | $values |
| Crawler |
Calls a URI.
| string | $method | The request method |
| string | $uri | The URI to fetch |
| array | $parameters | The Request parameters |
| array | $files | The files |
| array | $server | The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does) |
| string | $content | The raw body data |
| bool | $changeHistory | Whether to update the history or not (only used internally for back(), forward(), and reload()) |
| Crawler |
Makes a request in another process.
| object | $request | An origin request instance |
| object | An origin response instance |
| RuntimeException | When processing returns exit code |
Makes a request.
| object | $request | An origin request instance |
| object | An origin response instance |
Returns the script to execute when the request must be insulated.
| object | $request | An origin request instance |
Converts the BrowserKit request to a HttpKernel request.
| Request | $request | The BrowserKit Request to filter |
| object | An origin request instance |
Converts the HttpKernel response to a BrowserKit response.
| object | $response | The origin response to filter |
| Response | An BrowserKit Response instance |
Creates a crawler.
This method returns null if the DomCrawler component is not available.
| string | $uri | A URI |
| string | $content | Content for the crawler to use |
| string | $type | Content type |
| Crawler|null |
Goes back in the browser history.
| Crawler |
Goes forward in the browser history.
| Crawler |
Reloads the current browser.
| Crawler |
Follow redirects?
| Crawler |
| LogicException | If request was not a redirect |
Restarts the client.
It flushes history and all cookies.
Takes a URI and converts it to absolute if it is not already absolute.
| string | $uri | A URI |
| string | An absolute URI |
Makes a request from a Request object directly.
| Request | $request | A Request instance |
| bool | $changeHistory | Whether to update the history or not (only used internally for back(), forward(), and reload()) |
| Crawler |
Sets whether to catch exceptions when the kernel is handling a request.
| bool | $catchExceptions | Whether to catch exceptions |
Filters an array of files.
This method created test instances of UploadedFile so that the move() method can be called on those instances.
If the size of a file is greater than the allowed size (from php.ini) then an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
| array | $files |
| array | An array with all uploaded files marked as already moved |
| UploadedFile |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpKernel/Client.html