misantron / letsencrypt-client
LetsEncrypt client library for ACME v2
1.0.0-beta2
2020-03-26 13:40 UTC
Requires
- php: ^7.2
- ext-openssl: *
- guzzlehttp/guzzle: ^6.5
- psr/log: ^1.1
- spatie/enum: ^2.3
- webmozart/assert: ^1.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mikey179/vfsstream: ^1.6
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ^8.5
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-12-09 01:27:07 UTC
README
Installation
Use Composer to install the package:
composer require misantron/letsencrypt-client
Basic usage
Create client instance with defaults:
use LetsEncrypt\Client; $client = new Client($accountKeysPath, $certificatesPath);
By default client uses api staging environment.
To switch to production mode you can pass third argument to client constructor with false
value:
use LetsEncrypt\Client; $client = new Client($accountKeysPath, $certificatesPath, false);
Account methods
$client->account()->create(array $emails)
$client->account()->get()
$client->account()->getOrCreate(array $emails)
$client->account()->update(array $emails)
$client->account()->keyRollover()
$client->account()->deactive()
Order methods
$client->order()->create(Account $account, string $basename, array $subjects, Certificate $certificate)
$client->order()->get(Account $account, string $basename, array $subjects, KeyType $keyType)
$client->order()->getOrCreate(Account $account, string $basename, array $subjects, Certificate $certificate)
$client->order()->getPendingHttpAuthorizations(Account $account, Order $order)
$client->order()->getPendingDnsAuthorizations(Account $account, Order $order)
$client->order()->verifyPendingHttpAuthorizations(Account $account, Order $order, string $identifier)
$client->order()->verifyPendingDnsAuthorizations(Account $account, Order $order, string $identifier)
$client->order()->getCertificate(Account $account, Order $order, string $basename, KeyType $keyType)
$client->order()->getCertificateContent(string $basename, KeyType $keyType)
$client->order()->getCertificateExpirationDate(string $basename, KeyType $keyType)
$client->order()->revokeCertificate(Account $account, string $basename, KeyType $keyType, RevocationReason $reason)
Advanced usage
Logging
If you need to get some debug information or analyze server interaction
use LetsEncrypt\Client; use LetsEncrypt\Logger\Logger; use LetsEncrypt\Logger\LogStrategy; $strategy = LogStrategy::errorsOnly(); // $logger is an instance of PSR-3 logger (\Psr\Log\LoggerInterface) $clientLogger = new Logger($logger, $strategy); $client = new Client($accountKeysPath, $certificatesPath, true, $clientLogger);
Logger strategy
LogStrategy::requestsOnly()
log only requests dataLogStrategy::errorsOnly()
log only failed (400/500) requests (request/response data)LogStrategy::debugMode()
log all requests (request/response data)