PHP code example of programster / cert-manager

1. Go to this page and download the library: Download programster/cert-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

programster / cert-manager example snippets


// 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);