PHP Class Kelunik\Acme\AcmeClient

Author: Niklas Keller ([email protected])
Show file Open project: kelunik/acme

Public Methods

Method Description
__construct ( string $directoryUri, KeyPair $keyPair, Amp\Artax\HttpClient $http = null ) AcmeClient constructor.
get ( string $resource ) : Amp\Promise Retrieves a resource using a GET request.
post ( string $resource, array $payload ) : Amp\Promise Retrieves a resource using a POST request.

Private Methods

Method Description
buildClient ( ) : Client Constructs a default HTTP client.
doGet ( string $resource ) : Generator Retrieves a resource using a GET request.
doPost ( string $resource, array $payload ) : Generator Retrieves a resource using a POST request.
fetchDirectory ( ) : Generator Retrieves the directory and stores it in the directory property.
getNonce ( string $uri ) : Amp\Promise Pops a locally stored nonce or requests a new one for usage.
getResourceUri ( string $resource ) : Amp\Promise Returns the URI to a resource by querying the directory. Can also handle URIs and returns them directly.
requestNonce ( string $uri ) : Amp\Promise Requests a new request nonce from the server.
saveNonce ( Amp\Artax\Response $response ) Saves the nonce if one was provided in the response.

Method Details

__construct() public method

AcmeClient constructor.
public __construct ( string $directoryUri, KeyPair $keyPair, Amp\Artax\HttpClient $http = null )
$directoryUri string URI to the ACME server directory
$keyPair KeyPair account key pair
$http Amp\Artax\HttpClient custom HTTP client, default client will be used if no value is provided

get() public method

Retrieves a resource using a GET request.
public get ( string $resource ) : Amp\Promise
$resource string resource to fetch
return Amp\Promise resolves to the HTTP response

post() public method

Retrieves a resource using a POST request.
public post ( string $resource, array $payload ) : Amp\Promise
$resource string resource to fetch
$payload array
return Amp\Promise resolves to the HTTP response