Xolphin API wrapper for PHP

xolphin-php-api is a library which allows quick integration of the Xolphin REST API in PHP to automated ordering, issuance and installation of SSL Certificates.

Library installation

Library can be installed via Composer

composer require xolphin/xolphin-api-php

And updated via

composer update xolphin/xolphin-api-php

Usage

Client initialization

<?php

require 'vendor/autoload.php';

$client = new Xolphin\Client('<username>', '<password>');

Requests

Getting list of requests

$requests = $client->request()->all();
foreach($requests as $request) {
    echo $request->id . "\n";
}

Getting request by ID

$request = $client->request()->get(1234);
echo $request->id;

Request certificate

$products = $client->support()->products();

// request Comodo EssentialSSL certificate for 1 year
$request = $client->request()->create($products[1]->id, 1, '<csr_string>', 'EMAIL')
    ->setAddress("Address")
    ->setApproverFirstName("FirstName")
    ->setApproverLastName("LastName")
    ->setApproverPhone("+12345678901")
    ->setZipcode("123456")
    ->setCity("City")
    ->setCompany("Company")
    ->setApproverEmail('email@example.com')
    ->addSubjectAlternativeNames('test1.example.com')
    ->addSubjectAlternativeNames('test2.example.com')
    ->addSubjectAlternativeNames('test3.example.com')
    ->addDcv(new \Xolphin\Requests\RequestDCV('test1.example.com', 'EMAIL', 'email1@example.com'))
    ->addDcv(new \Xolphin\Requests\RequestDCV('test2.example.com', 'EMAIL', 'email2@example.com'));

$client->request()->send($request);

Certificate

Certificates list and expirations

$certificates = $client->certificate()->all();
foreach($certificates as $certificate) {
    echo $certificate->id . ' - ' . $certificate->isExpired() . "\n";
}

Download certificate

$certificates = $client->certificate()->all();
$cert = $client->certificate()->download($certificates[0]->id);
file_put_contents('cert.crt', $cert);

Support

Products list

$products = $client->support()->products();
foreach($products as $product) {
    echo $product->id . "\n";
}

Decode CSR

$csr = $client->support()->decodeCSR('<your csr string>');
echo $csr->type;
point up