programster / cert-manager
An SDK for interfacing with Programster's TLS certificate manager
1.1.0
2025-01-28 14:09 UTC
Requires
- php: >=8.2.0
- programster/collections: ^0.1.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- fakerphp/faker: ^1.24
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
- programster/core-libs: 2.1.*
- symfony/http-client: ^5.3
This package is not auto-updated.
Last update: 2025-01-29 12:38:33 UTC
README
A package to facilitate interfacing with Programster's TLS certificate manager.
Example Usage
The example below uses Guzzle for the HTTP message library and factory, because it is the most commonly used, but you are welcome to use anything that is PSR-7 and PSR-17 compliant.
// Create the client for interfacing with the API: $messagingClient = new \GuzzleHttp\Client(); $requestFactory = new \GuzzleHttp\Psr7\HttpFactory(); $client = CertManagerClient( $messagingClient, $requestFactory, $myAuthTokenId, $myAuthTokenSecret, "https://certs.mydomain.com" ); // Use the client to upload a set of certificates you created: $response = $client->createCertificateBundle( id: "9e138e97-1df3-4f44-9aeb-f54636dae710", name: "certificate for my.domain.com", cert: "....", chain: "...", fullchain: "....", privateKey: "....", ); // ... and to retrieve the certificate and write it out somewhere: $certificateBundle = $client->getCertificateBundle( id: "9e138e97-1df3-4f44-9aeb-f54636dae710", ); file_put_contents('/path/to/fullchain.pem', $certificateBundle->fullchain); file_put_contents('/path/to/private.pem', $certificateBundle->privateKey);
Testing
To run the tests:
- Fill in the
testing/TestSettings.php.tmpl
and rename it totesting/TestSettings.php
- Run the tests with
php testing/main.php