2017 © Pedro Peláez
 

library xolphin-api-php

Xolphin API module for PHP

image

xolphin/xolphin-api-php

Xolphin API module for PHP

  • Thursday, April 12, 2018
  • by xolphin
  • Repository
  • 3 Watchers
  • 4 Stars
  • 3,917 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 3 Open issues
  • 7 Versions
  • 19 % Grown

The README.md

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., (*1)

About Xolphin

Xolphin is the largest supplier of SSL Certificates and Digital Signatures in the Netherlands. Xolphin has a professional team providing reliable support and rapid issuance of SSL Certificates at an affordable price from industry leading brands such as Sectigo, GeoTrust, GlobalSign, Thawte and Symantec., (*2)

Library installation

Library can be installed via Composer, (*3)

composer require xolphin/xolphin-api-php

And updated via, (*4)

composer update xolphin/xolphin-api-php

Upgrade guide: from v2.x to v3.x

  • Access pagination attributes from $response->getPagination()->{{method}};
  • Remove all EE (EncryptionEverywhere) blocks from your code, it has finally been removed.
  • Make sure you enforce the right types since we enforce strict-typing now.

Upgrade guide from v1.8.3 to v2.x

Update your xolphin/xolphin-api-php dependency to ^2.0 in your composer.json file., (*5)

Renamed classes

All endpoint classes have been renamed to a more generic name <resource>Endpoint. You should update your usages., (*6)

Calling Endpoint classes

All endpoint classes are started during startup They can be called using $client->certificates->all() instead of $client->certificate()->all()., (*7)

Using Helpers instead of strings

In version 2.0.0 we introduced Helper classes. These classes contain constants of all static string variables (enums). Use these constants instead of a string, because we will alter these constants whenever we change the corresponding value in the API., (*8)

For instance, when creating a DCV for a domain:, (*9)

$dcvDomain = new Xolphin\Requests\DCVDomain('someDomain', Xolphin\Helpers\DCVTypes::EMAIL_VALIDATION, 'someemail@address.com');

Certificate download() method returns string

The method download() on the class CertificatesEndpoint now returns the certificate string instead of the GuzzlestreamInterface., (*10)

Usage

Client initialization

<?php

require 'vendor/autoload.php';

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

Rate Limiting

Current limit

$limit = $client->getLimit();
echo $limit . PHP_EOL;

Requests remaining for limit

$requestsRemaining = $client->getRequestsRemaining();
echo $requestsRemaining . PHP_EOL;

Requests

Get list of requests

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

Get request by ID

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

Request certificate

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

// request Sectigo EssentialSSL certificate for 1 year
$request = $client->requests->create($products[1]->id, 1, '<csr_string>', DCVTypes::EMAIL_VALIDATION)
    ->setAddress("Address")
    ->setApproverFirstName("FirstName")
    ->setApproverLastName("LastName")
    ->setApproverPhone("+12345678901")
    ->setZipcode("123456")
    ->setCity("City")
    ->setCompany("Company")
    ->setApproverEmail('email@domain.com')
    //currently available languages defined in RequestLanguages
    ->setLanguage(RequestLanguage::ENGLISH)
    ->addSubjectAlternativeNames('test1.domain.com')
    ->addSubjectAlternativeNames('test2.domain.com')
    ->addSubjectAlternativeNames('test3.domain.com')
    ->addDcv(new \Xolphin\Requests\DCVDomain('test1.domain.com', DCVTypes::EMAIL_VALIDATION, 'email1@domain.com'))
    ->addDcv(new \Xolphin\Requests\DCVDomain('test2.domain.com', DCVTypes::EMAIL_VALIDATION, 'email2@domain.com'));

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

Reissue certificate

// Reissue a current certificate
$reissue = new \Xolphin\Requests\ReissueRequest('<csr_string>', DCVTypes::EMAIL_VALIDATION);
$reissue->setApproverEmail('email@domain.com');

$client->certificates->reissue(<certificate_id>, $reissue);

Renew certificate

// Renew a current certificate
$currentCertificate = $client->certificates->get(<certificate_id>);

$renew = new \Xolphin\Requests\RenewRequest($currentCertificate->product, <years>, '<csr_string>', DCVTypes::FILE_VALIDATION);
$renew->setApproverEmail('email@domain.com');

$client->certificates->renew(<certificate_id>, $renew);

Create a note

$result = $client->requests->sendNote(1234, 'My message');

Get list of notes

$notes =  $client->requests->getNotes(1234);
foreach($notes as $note){
    echo $note->messageBody . PHP_EOL;
}

Send a "Sectigo Subscriber Agreement" email

//currently available languages defined in RequestLanguages
$client->requests->sendSectigoSAEmail(1234, 'mail@example.com', RequestLanguage::ENGLISH);

Certificate

Certificates list and expirations

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

Download certificate

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

Support

List of products

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

Decode CSR

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

Invoices

List of invoices

$invoices = $client->invoices->all();
foreach($invoices as $invoice) {
    echo $invoice->id . ' ' . $invoice->invoiceNr . ' ' . $invoice->amount . PHP_EOL;
}

Download Invoice in PDF format

$invoices = $client->invoices->all();
$invoicePdf = $client->invoices->download($invoices[0]->id, InvoiceDownloadTypes::PDF);
file_put_contents('invoice.pdf' , $invoicePdf);

The Versions

12/04 2018

dev-master

9999999-dev

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

12/12 2017

1.6.1

1.6.1.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

18/07 2017

1.6.0

1.6.0.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

06/10 2016

1.2.1

1.2.1.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

06/10 2016

1.2

1.2.0.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

10/06 2016

1.1.2

1.1.2.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com

30/05 2016

1.1.1

1.1.1.0

Xolphin API module for PHP

  Sources   Download

MIT

The Requires

 

by Roman Ragimoff
by Avatar xolphin

api xolphin xolphin.com