Documentation

HttpClientFactory
in package

Class HttpClientFactory

Configures a Guzzle HTTP client for use with Graph API

Tags
copyright

2021 Microsoft Corporation

license

https://opensource.org/licenses/MIT MIT License

link
https://developer.microsoft.com/graph

Table of Contents

CONNECTION_TIMEOUT_SEC  = 30
REQUEST_TIMEOUT_SEC  = 100
$clientConfig  : array<string|int, mixed>
$instance  : HttpClientFactory|null
$nationalCloud  : string
create()  : Client
Creates a Guzzle client with the custom configs provided or a default client if no config was given Creates default Guzzle client if no custom configs were passed
createAdapter()  : HttpClientInterface
Creates an HttpClientInterface implementation that wraps around a Guzzle client
setClientConfig()  : $this
Set configuration options for the Guzzle client
setNationalCloud()  : $this
Set national cloud to be used as the base URL
__construct()  : mixed
HttpClientFactory constructor.
getDefaultConfig()  : array<string|int, mixed>
Returns Graph-specific config for Guzzle
getInstance()  : HttpClientFactory
Returns singleton instance
mergeConfig()  : void
Merges client defined config array with Graph's default config.

Constants

Properties

$nationalCloud

private static string $nationalCloud = MicrosoftGraphCoreNationalCloud::GLOBAL

Methods

create()

Creates a Guzzle client with the custom configs provided or a default client if no config was given Creates default Guzzle client if no custom configs were passed

public static create() : Client
Return values
Client

setClientConfig()

Set configuration options for the Guzzle client

public static setClientConfig(array<string|int, mixed> $config) : $this
Parameters
$config : array<string|int, mixed>
Return values
$this

setNationalCloud()

Set national cloud to be used as the base URL

public static setNationalCloud([string $nationalCloud = NationalCloud::GLOBAL ]) : $this
Parameters
$nationalCloud : string = NationalCloud::GLOBAL
Tags
throws
GraphClientException

if $nationalCloud is empty or an invalid national cloud Host

Return values
$this

__construct()

HttpClientFactory constructor.

private __construct() : mixed
Return values
mixed

getDefaultConfig()

Returns Graph-specific config for Guzzle

private static getDefaultConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

mergeConfig()

Merges client defined config array with Graph's default config.

private static mergeConfig() : void

Provides defaults for timeouts and headers if none have been provided. Overrides base_uri.

Return values
void

Search results