Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • AbstractEntityBodyDecorator
  • CachingEntityBody
  • Client
  • EntityBody
  • IoEmittingEntityBody
  • Mimetypes
  • QueryString
  • ReadLimitEntityBody
  • RedirectPlugin
  • Url

Interfaces

  • ClientInterface
  • EntityBodyInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

Class Client

HTTP client

Guzzle\Common\AbstractHasDispatcher implements Guzzle\Common\HasDispatcherInterface
Extended by Guzzle\Http\Client implements Guzzle\Http\ClientInterface

Direct known subclasses

Guzzle\Service\Client
Namespace: Guzzle\Http
Located at Guzzle/Http/Client.php
Methods summary
public static array
# getAllEvents( )

Get a list of all of the events emitted from the class

Get a list of all of the events emitted from the class

Returns

array

Overrides

Guzzle\Common\AbstractHasDispatcher::getAllEvents()

Implementation of

Guzzle\Common\HasDispatcherInterface::getAllEvents()
public
# __construct( string $baseUrl = '', array|Guzzle\Common\Collection $config = null )

Client constructor

Client constructor

Parameters

$baseUrl
string
$baseUrl Base URL of the web service
$config
array|Guzzle\Common\Collection
$config Configuration settings
final public Guzzle\Http\ClientInterface
# setConfig( array|Guzzle\Common\Collection|string $config )

Set the configuration object to use with the client

Set the configuration object to use with the client

Parameters

$config
array|Guzzle\Common\Collection|string
$config Parameters that define how the client behaves and connects to a webservice. Pass an array or a Collection object.

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setConfig()
final public mixed|Guzzle\Common\Collection
# getConfig( boolean|string $key = false )

Get a configuration setting or all of the configuration settings

Get a configuration setting or all of the configuration settings

Parameters

$key
boolean|string
$key Configuration value to retrieve. Set to FALSE to retrieve all values of the client. The object return can be modified, and modifications will affect the client's config.

Returns

mixed|Guzzle\Common\Collection

Implementation of

Guzzle\Http\ClientInterface::getConfig()
final public Guzzle\Http\ClientInterface
# setSslVerification( string|boolean $certificateAuthority = true, boolean $verifyPeer = true, integer $verifyHost = 2 )

Set SSL verification options.

Set SSL verification options.

Parameters

$certificateAuthority
string|boolean
$certificateAuthority bool, file path, or directory path
$verifyPeer
boolean
$verifyPeer FALSE to stop cURL from verifying the peer's certificate.
$verifyHost
integer
$verifyHost Set the cURL handle's CURLOPT_SSL_VERIFYHOST option

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setSslVerification()
public Guzzle\Common\Collection
# getDefaultHeaders( )

Get the default HTTP headers to add to each request created by the client

Get the default HTTP headers to add to each request created by the client

Returns

Guzzle\Common\Collection

Implementation of

Guzzle\Http\ClientInterface::getDefaultHeaders()
public Guzzle\Http\ClientInterface
# setDefaultHeaders( array|Guzzle\Common\Collection $headers )

Set the default HTTP headers to add to each request created by the client

Set the default HTTP headers to add to each request created by the client

Parameters

$headers
array|Guzzle\Common\Collection
$headers Default HTTP headers

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setDefaultHeaders()
public string
# expandTemplate( string $template, array $variables = null )

Expand a URI template using client configuration data

Expand a URI template using client configuration data

Parameters

$template
string
$template URI template to expand
$variables
array
$variables Additional variables to use in the expansion

Returns

string

Implementation of

Guzzle\Http\ClientInterface::expandTemplate()
public Guzzle\Http\ClientInterface
# setUriTemplate( Guzzle\Parser\UriTemplate\UriTemplateInterface $uriTemplate )

Set the URI template expander to use with the client

Set the URI template expander to use with the client

Parameters

$uriTemplate
Guzzle\Parser\UriTemplate\UriTemplateInterface
$uriTemplate URI template expander

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setUriTemplate()
public Guzzle\Parser\UriTemplate\UriTemplateInterface
# getUriTemplate( )

Get the URI template expander used by the client

Get the URI template expander used by the client

Returns

Guzzle\Parser\UriTemplate\UriTemplateInterface

Implementation of

Guzzle\Http\ClientInterface::getUriTemplate()
public Guzzle\Http\Message\RequestInterface
# createRequest( string $method = Guzzle\Http\RequestInterface::GET, string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|array|Guzzle\Http\EntityBodyInterface $body = null )

Create and return a new Guzzle\Http\Message\RequestInterface configured for the client.

Create and return a new Guzzle\Http\Message\RequestInterface configured for the client.

Parameters

$method
string
$method HTTP method. Defaults to GET
$uri
string|array
$uri Resource URI.
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|array|Guzzle\Http\EntityBodyInterface
$body Entity body of request (POST/PUT) or response (GET)

Returns

Guzzle\Http\Message\RequestInterface

Throws

Guzzle\Common\Exception\InvalidArgumentException
if a URI array is passed that does not contain exactly two elements: the URI followed by template variables

Implementation of

Guzzle\Http\ClientInterface::createRequest()
public string|null
# getBaseUrl( boolean $expand = true )

Get the client's base URL as either an expanded or raw URI template

Get the client's base URL as either an expanded or raw URI template

Parameters

$expand
boolean
$expand Set to FALSE to get the raw base URL without URI template expansion

Returns

string|null

Implementation of

Guzzle\Http\ClientInterface::getBaseUrl()
public Guzzle\Http\ClientInterface
# setBaseUrl( string $url )

Set the base URL of the client

Set the base URL of the client

Parameters

$url
string
$url The base service endpoint URL of the webservice

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setBaseUrl()
public Guzzle\Http\Client
# setUserAgent( string $userAgent, boolean $includeDefault = false )

Set the User-Agent header to be used on all requests from the client

Set the User-Agent header to be used on all requests from the client

Parameters

$userAgent
string
$userAgent User agent string
$includeDefault
boolean
$includeDefault Set to true to prepend the value to Guzzle's default user agent string

Returns

Guzzle\Http\Client

Implementation of

Guzzle\Http\ClientInterface::setUserAgent()
public string
# getDefaultUserAgent( )

Get the default User-Agent string to use with Guzzle

Get the default User-Agent string to use with Guzzle

Returns

string
public Guzzle\Http\Message\RequestInterface
# get( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|array|Guzzle\Http\EntityBodyInterface $body = null )

Create a GET request for the client

Create a GET request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|array|Guzzle\Http\EntityBodyInterface
$body Where to store the response entity body

Returns

Guzzle\Http\Message\RequestInterface

Implementation of

Guzzle\Http\ClientInterface::get()
public Guzzle\Http\Message\RequestInterface
# head( string|array $uri = null, array|Guzzle\Common\Collection $headers = null )

Create a HEAD request for the client

Create a HEAD request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers

Returns

Guzzle\Http\Message\RequestInterface

Implementation of

Guzzle\Http\ClientInterface::head()
public EntityEnclosingRequestInterface
# delete( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null )

Create a DELETE request for the client

Create a DELETE request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request

Returns

EntityEnclosingRequestInterface

Implementation of

Guzzle\Http\ClientInterface::delete()
public EntityEnclosingRequestInterface
# put( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null )

Create a PUT request for the client

Create a PUT request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request

Returns

EntityEnclosingRequestInterface

Implementation of

Guzzle\Http\ClientInterface::put()
public EntityEnclosingRequestInterface
# patch( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null )

Create a PATCH request for the client

Create a PATCH request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request

Returns

EntityEnclosingRequestInterface

Implementation of

Guzzle\Http\ClientInterface::patch()
public EntityEnclosingRequestInterface
# post( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, array|Guzzle\Common\Collection|string|Guzzle\Http\EntityBodyInterface $postBody = null )

Create a POST request for the client

Create a POST request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$postBody
array|Guzzle\Common\Collection|string|Guzzle\Http\EntityBodyInterface
$postBody POST body. Can be a string, EntityBody, or associative array of POST fields to send in the body of the request. Prefix a value in the array with the @ symbol to reference a file.

Returns

EntityEnclosingRequestInterface

Implementation of

Guzzle\Http\ClientInterface::post()
public Guzzle\Http\Message\RequestInterface
# options( string|array $uri = null )

Create an OPTIONS request for the client

Create an OPTIONS request for the client

Parameters

$uri
string|array
$uri Resource URI

Returns

Guzzle\Http\Message\RequestInterface

Implementation of

Guzzle\Http\ClientInterface::options()
public array
# send( array $requests )

Sends a single request or an array of requests in parallel

Sends a single request or an array of requests in parallel

Parameters

$requests
array
$requests Request(s) to send

Returns

array
Returns the response(s)

Implementation of

Guzzle\Http\ClientInterface::send()
public Guzzle\Http\ClientInterface
# setCurlMulti( Guzzle\Http\Curl\CurlMultiInterface $curlMulti )

Set a curl multi object to be used internally by the client for transferring requests.

Set a curl multi object to be used internally by the client for transferring requests.

Parameters

$curlMulti
Guzzle\Http\Curl\CurlMultiInterface
$curlMulti Multi object

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setCurlMulti()
public Guzzle\Http\Curl\CurlMultiInterface
# getCurlMulti( )

Get the curl multi object to be used internally by the client for transferring requests.

Get the curl multi object to be used internally by the client for transferring requests.

Returns

Guzzle\Http\Curl\CurlMultiInterface

Implementation of

Guzzle\Http\ClientInterface::getCurlMulti()
public Guzzle\Http\ClientInterface
# setRequestFactory( Guzzle\Http\Message\RequestFactoryInterface $factory )

Set the request factory to use with the client when creating requests

Set the request factory to use with the client when creating requests

Parameters

$factory
Guzzle\Http\Message\RequestFactoryInterface
$factory Request factory

Returns

Guzzle\Http\ClientInterface

Implementation of

Guzzle\Http\ClientInterface::setRequestFactory()
public string
# preparePharCacert( boolean $md5Check = true )

Copy the cacert.pem file from the phar if it is not in the temp folder and validate the MD5 checksum

Copy the cacert.pem file from the phar if it is not in the temp folder and validate the MD5 checksum

Parameters

$md5Check
boolean
$md5Check Set to false to not perform the MD5 validation

Returns

string
Returns the path to the extracted cacert

Throws

Guzzle\Common\Exception\RuntimeException
if the file cannot be copied or there is a MD5 mismatch
protected Guzzle\Http\Message\RequestInterface
# prepareRequest( Guzzle\Http\Message\RequestInterface $request )

Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request.

Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request.

Parameters

$request
Guzzle\Http\Message\RequestInterface
$request Request to prepare for the client

Returns

Guzzle\Http\Message\RequestInterface
protected
# initSsl( )

Initializes SSL settings

Initializes SSL settings

Methods inherited from Guzzle\Common\AbstractHasDispatcher
addSubscriber(), dispatch(), getEventDispatcher(), setEventDispatcher()
Constants summary
string REQUEST_PARAMS 'request.params'
#
string CURL_OPTIONS 'curl.options'
#
string SSL_CERT_AUTHORITY 'ssl.certificate_authority'
#
string DISABLE_REDIRECTS Guzzle\Http\RedirectPlugin::DISABLE
#
Constants inherited from Guzzle\Http\ClientInterface
CREATE_REQUEST, HTTP_DATE
Properties summary
protected Guzzle\Common\Collection $defaultHeaders
#

Default HTTP headers to set on each request

Default HTTP headers to set on each request

protected string $userAgent
#

The user agent string to set on each request

The user agent string to set on each request

protected Guzzle\Http\Message\RequestFactoryInterface $requestFactory
#

Request factory used by the client

Request factory used by the client

Properties inherited from Guzzle\Common\AbstractHasDispatcher
$eventDispatcher
php-coveralls API documentation generated by ApiGen 2.8.0