GuzzleService
in package
Guzzle service.
N.B. Use only for dependencies that require Guzzle.
Tags
Table of Contents
- LOCAL_ADDRESS_RE = '@^(localhost|127(\\.\\d+){3}|\\[::1\\])@'
- Default regular expression matching a request to localhost.
- $config : array<string|int, mixed>
- VuFind configuration
- $guzzleHttpSettingsMap : array<string|int, mixed>
- Mappings from VuFind HTTP settings to Guzzle
- $localAddressesRegEx : string
- Regular expression matching a request to localhost or hosts that are not proxied.
- __construct() : void
- Constructor.
- createClient() : ClientInterface
- Return a new Guzzle client.
- getGuzzleConfig() : array<string|int, mixed>
- Get Guzzle options
- isLocal() : bool
- Check if given URL is a local address
Constants
LOCAL_ADDRESS_RE
Default regular expression matching a request to localhost.
public
string
LOCAL_ADDRESS_RE
= '@^(localhost|127(\\.\\d+){3}|\\[::1\\])@'
Properties
$config
VuFind configuration
protected
array<string|int, mixed>
$config
$guzzleHttpSettingsMap
Mappings from VuFind HTTP settings to Guzzle
protected
array<string|int, mixed>
$guzzleHttpSettingsMap
= ['timeout' => 'timeout', 'curloptions' => 'curl']
$localAddressesRegEx
Regular expression matching a request to localhost or hosts that are not proxied.
protected
string
$localAddressesRegEx
= self::LOCAL_ADDRESS_RE
Tags
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
-
VuFind configuration
Return values
void —createClient()
Return a new Guzzle client.
public
createClient([string|null $url = null ][, float|null $timeout = null ]) : ClientInterface
Parameters
- $url : string|null = null
-
Target URL (required for proper proxy setup for non-local addresses)
- $timeout : float|null = null
-
Request timeout in seconds (overrides configuration)
Return values
ClientInterface —getGuzzleConfig()
Get Guzzle options
protected
getGuzzleConfig(string|null $url, float|null $timeout) : array<string|int, mixed>
Parameters
- $url : string|null
-
Target URL (required for proper proxy setup for non-local addresses)
- $timeout : float|null
-
Request timeout in seconds
Return values
array<string|int, mixed> —isLocal()
Check if given URL is a local address
protected
isLocal(string|null $host) : bool
Parameters
- $host : string|null
-
Host to check