Akamai {OPEN} EdgeGrid Authentication for PHP
  • Namespace
  • Class
  • Tree

Namespaces

  • Akamai
    • Open
      • EdgeGrid
        • Authentication
          • Exception
            • SignerException
        • Exception
          • HandlerException
        • Handler

Classes

  • Authentication
  • Cli
  • Client

Exceptions

  • Exception

Class Client

Akamai {OPEN} EdgeGrid Client for PHP

Akamai\Open\EdgeGrid\Client wraps GuzzleHttp\Client providing request authentication/signing for Akamai {OPEN} APIs.

This client works identically to GuzzleHttp\Client

However, if you try to call an Akamai {OPEN} API you must first call Akamai\Open\EdgeGrid\Client->setAuth().

GuzzleHttp\Client
Extended by Akamai\Open\EdgeGrid\Client implements Psr\Log\LoggerAwareInterface
Namespace: Akamai\Open\EdgeGrid
Package: Akamai\Open\EdgeGrid\Client
Located at Client.php

Methods summary

public
# __construct( array $config = [], Akamai\Open\EdgeGrid\Authentication $authentication = null )

\GuzzleHttp\Client-compatible constructor

\GuzzleHttp\Client-compatible constructor

Parameters

$config
Config options array
$authentication
public GuzzleHttp\Promise\PromiseInterface
# requestAsync( string $method, string $uri = null, array $options = [] )

Make an Asynchronous request

Make an Asynchronous request

Parameters

$method
$uri
$options

Returns

GuzzleHttp\Promise\PromiseInterface

Throws

GuzzleHttp\Exception\GuzzleException
public GuzzleHttp\Promise\PromiseInterface
# sendAsync( Psr\Http\Message\RequestInterface $request, array $options = [] )

Send an Asynchronous HTTP request

Send an Asynchronous HTTP request

Parameters

$request
The HTTP request
$options
Request options

Returns

GuzzleHttp\Promise\PromiseInterface
public
# setAuth( string $client_token, string $client_secret, string $access_token )

Set Akamai {OPEN} Authentication Credentials

Set Akamai {OPEN} Authentication Credentials

Parameters

$client_token
$client_secret
$access_token

Returns


$this
public
# setHeadersToSign( array $headers )

Specify the headers to include when signing the request

Specify the headers to include when signing the request

This is specified by the API, currently no APIs use this feature.

Parameters

$headers

Returns


$this
public
# setMaxBodySize( integer $max_body_size )

Set the max body size

Set the max body size

Parameters

$max_body_size

Returns


$this
public
# setHost( string $host )

Set Request Host

Set Request Host

Parameters

$host

Returns


$this
public
# setTimeout( integer $timeout_in_seconds )

Set the HTTP request timeout

Set the HTTP request timeout

Parameters

$timeout_in_seconds

Returns


$this
public
# setInstanceVerbose( boolean|resource $enable )

Print formatted JSON responses to output

Print formatted JSON responses to output

Parameters

$enable

Returns


$this
public
# setInstanceDebug( boolean|resource $enable )

Print HTTP requests/responses to output

Print HTTP requests/responses to output

Parameters

$enable

Returns


$this
public
# setLogger( Psr\Log\LoggerInterface $logger = null, string $messageFormat = \GuzzleHttp\MessageFormatter::CLF )

Set a PSR-3 compatible logger (or use monolog by default)

Set a PSR-3 compatible logger (or use monolog by default)

Parameters

$logger
$messageFormat
Message format

Returns


$this
public Akamai\Open\EdgeGrid\Client|boolean
# setSimpleLog( string $filename, string $format = '{code}' )

Add logger using a given filename/format

Add logger using a given filename/format

Parameters

$filename
$format

Returns

Akamai\Open\EdgeGrid\Client|boolean
public static Akamai\Open\EdgeGrid\Client
# createInstance( string $section = 'default', null $path = null, array $config = [] )

Create instance using environment (preferred) or .edgerc file (fallback) automatically.

Create instance using environment (preferred) or .edgerc file (fallback) automatically.

Parameters

$section
$path
$config

Returns

Akamai\Open\EdgeGrid\Client

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\ConfigException
public static
# createFromEnv( $section = 'default', array $config = [] )
public static Akamai\Open\EdgeGrid\Client
# createFromEdgeRcFile( string $section = 'default', string $path = null, array $config = [] )

Factory method to create a client using credentials from .edgerc

Factory method to create a client using credentials from .edgerc

Automatically checks your HOME directory, and the current working directory for credentials, if no path is supplied.

Parameters

$section
Credential section to use
$path
Path to .edgerc credentials file
$config
Options to pass to the constructor/guzzle

Returns

Akamai\Open\EdgeGrid\Client
public static
# setDebug( boolean|resource $enable )

Print HTTP requests/responses to STDOUT

Print HTTP requests/responses to STDOUT

Parameters

$enable
public static
# setVerbose( boolean|resource|array $enable )

Print formatted JSON responses to STDOUT

Print formatted JSON responses to STDOUT

Parameters

$enable
protected boolean|resource
# getDebugOption( array $config )

Handle debug option

Handle debug option

Parameters

$config

Returns

boolean|resource
protected boolean|resource
# isDebug( )

Debugging status for the current request

Debugging status for the current request

Returns

boolean|resource
protected array|boolean|resource
# isVerbose( )

Verbose status for the current request

Verbose status for the current request

Returns

array|boolean|resource
protected
# setAuthentication( array $config, Akamai\Open\EdgeGrid\Authentication $authentication = null )

Set the Authentication instance

Set the Authentication instance

Parameters

$config
$authentication
protected array
# setAuthenticationHandler( array $config, Akamai\Open\EdgeGrid\Authentication $authentication = null )

Set the Authentication Handler

Set the Authentication Handler

Parameters

$config
$authentication

Returns

array
protected mixed
# setBasicOptions( array $config )

Set timeout and base_uri options

Set timeout and base_uri options

Parameters

$config

Returns

mixed
protected
# setConfigOption( string $what, mixed $value )

Set values on the private \GuzzleHttp\Client->config

Set values on the private \GuzzleHttp\Client->config

This is a terrible hack, and illustrates why making anything private makes it difficult to extend, and impossible when there is no setter.

Parameters

$what
Config option to set
$value
Value to set the option to
protected array
# setDebugHandler( array $options, boolean|resource|null $fp = null )

Add the Debug handler to the HandlerStack

Add the Debug handler to the HandlerStack

Parameters

$options
Guzzle Options
$fp
Stream to write to

Returns

array
protected
# setLogHandler( GuzzleHttp\HandlerStack $handlerStack, callable $logHandler )

Add the Log handler to the HandlerStack

Add the Log handler to the HandlerStack

Parameters

$handlerStack
$logHandler

Returns


$this
protected array
# setVerboseHandler( array $options, boolean|resource|array|null $fp = null )

Add the Verbose handler to the HandlerStack

Add the Verbose handler to the HandlerStack

Parameters

$options
Guzzle Options
$fp
Stream to write to

Returns

array
protected array
# setRequestOptions( array $options )

Set request specific options

Set request specific options

Parameters

$options

Returns

array

Constants summary

string VERSION
# '1.0.0'
integer DEFAULT_REQUEST_TIMEOUT

Const

int Default Timeout in seconds
# 300

Properties summary

protected static boolean|array|resource $staticVerbose

Whether verbose mode is enabled

  • true - Use STDERR
  • array - output/error streams (different)
  • resource - output/error stream (same)

Whether verbose mode is enabled

  • true - Use STDERR
  • array - output/error streams (different)
  • resource - output/error stream (same)
# false
protected static boolean|resource $staticDebug

Whether debug mode is enabled

Whether debug mode is enabled

# false
protected Akamai\Open\EdgeGrid\Authentication $authentication
#
protected Akamai\Open\EdgeGrid\Handler\Verbose $verboseHandler
#
protected Akamai\Open\EdgeGrid\Handler\Debug $debugHandler
#
protected boolean|array|resource $verbose

Whether verbose mode is enabled

  • true - Use STDOUT
  • array - output/error streams (different)
  • resource - output/error stream (same)

Whether verbose mode is enabled

  • true - Use STDOUT
  • array - output/error streams (different)
  • resource - output/error stream (same)
# false
protected boolean|resource $debug

Whether debugging is enabled

Whether debugging is enabled

# false
protected boolean $verboseOverride

Whether to override the static verbose setting

Whether to override the static verbose setting

# false
protected boolean $debugOverride

Whether to override the static debug setting

Whether to override the static debug setting

# false
protected callable $logger

Logging Handler

Logging Handler

#
Akamai {OPEN} EdgeGrid Authentication for PHP API documentation generated by ApiGen