VuFind API Documentation

GuzzleService
in package

Guzzle service.

N.B. Use only for dependencies that require Guzzle.

Tags
category

VuFind

author

Ere Maijala ere.maijala@helsinki.fi

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link
https://vufind.org/wiki/development
todo

Merge with PSR-18 HTTP Client Service when implemented

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
see
Proxy::$config

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

Return values
bool

Search results