Skip to content

Commit 511a237

Browse files
author
Bart Faber
committed
Updated files for release 2.0.0
1 parent 254a7af commit 511a237

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1948
-1170
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Changelog
22
All notable changes to the wrapper will be documented in this file.
33

4+
## [2.0.0]
5+
### Updated
6+
- Support for PHP upgraded to >= 7.2
7+
- Support for PHP 5.6 is now on deprecated. Latest version supporting this is 1.8.4
8+
- Refactored UnitTests for compatibility with PHPUnit 8
9+
- Removed method sendComodoSAEmail on Request Endpoint
10+
- Lowered Endpoint class creation count ($client->certificate()->... is now $client->certificates->...)
11+
12+
### Added
13+
- Created seperate namespace for Helpers that return API Strings
14+
415
## [1.8.3]
516
### Added
617
- Added support for SSLCheck

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xolphin/xolphin-api-php",
3-
"version": "1.8.3",
3+
"version": "2.0.0",
44
"description": "Xolphin API module for PHP",
55
"license": "MIT",
66
"keywords": [
@@ -26,12 +26,12 @@
2626
"email": "[email protected]"
2727
},
2828
"require": {
29-
"php": ">=5.6.0",
29+
"php": ">=7.2.0",
3030
"guzzlehttp/guzzle": "~6",
3131
"ext-json": "*"
3232
},
3333
"require-dev": {
34-
"phpunit/phpunit": "^5.3"
34+
"phpunit/phpunit": "~8"
3535
},
3636
"autoload": {
3737
"psr-4": {

readme.md

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
**IMPORTANT: This will be one of the last releases for the v1 major (except for security updates). We're working on a new major version (v2.x) with PHP7 support. From v2 onward, it will no longer be backward compatible with the v1.x releases of the wrapper. Also, we will no longer name the releases after our API version (which will remain at v1).**
2-
31
# Xolphin API wrapper for PHP
42
xolphin-php-api is a library which allows quick integration of the [Xolphin REST API](https://api.xolphin.com) in PHP to automated ordering, issuance and installation of SSL Certificates.
53

64
## About Xolphin
7-
[Xolphin](https://www.xolphin.nl/) is the largest supplier of [SSL Certificates](https://www.sslcertificaten.nl) and [Digital Signatures](https://www.digitalehandtekeningen.nl) 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 Comodo, GeoTrust, GlobalSign, Thawte and Symantec.
5+
[Xolphin](https://www.xolphin.nl/) is the largest supplier of [SSL Certificates](https://www.sslcertificaten.nl) and [Digital Signatures](https://www.digitalehandtekeningen.nl) 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.
86

97
## Library installation
108

@@ -20,6 +18,28 @@ And updated via
2018
composer update xolphin/xolphin-api-php
2119
```
2220

21+
### Upgrade guide from v1.8.3 to v2.x
22+
Update your `xolphin/xolphin-api-php` dependency to `^2.0` in your `composer.json` file.
23+
24+
#### Renamed classes
25+
All endpoint classes have been renamed to a more generic name `<resource>Endpoint`. You should update your usages.
26+
27+
#### Calling Endpoint classes
28+
All endpoint classes are started during startup
29+
They can be called using `$client->certificates->all()` instead of `$client->certificate()->all()`.
30+
31+
#### Using Helpers instead of strings
32+
In version 2.0.0 we introduced Helper classes. These classes contain constants of all static string variables (enums).
33+
Use these constants instead of a string, because we will alter these constants whenever we change the corresponding value in the API.
34+
35+
For instance, when creating a DCV for a domain:
36+
```php
37+
$dcvDomain = new Xolphin\Requests\DCVDomain('someDomain', Xolphin\Helpers\DCVTypes::EMAIL_VALIDATION, '[email protected]');
38+
```
39+
40+
#### Certificate download() method returns string
41+
The method `download()` on the class `CertificatesEndpoint` now returns the certificate string instead of the `GuzzlestreamInterface`.
42+
2343
## Usage
2444

2545
### Client initialization
@@ -51,7 +71,7 @@ echo $requestsRemaining . "\n";
5171
#### Get list of requests
5272

5373
```php
54-
$requests = $client->request()->all();
74+
$requests = $client->requests->all();
5575
foreach($requests as $request) {
5676
echo $request->id . "\n";
5777
}
@@ -60,17 +80,17 @@ foreach($requests as $request) {
6080
#### Get request by ID
6181

6282
```php
63-
$request = $client->request()->get(1234);
83+
$request = $client->requests->get(1234);
6484
echo $request->id;
6585
```
6686

6787
#### Request certificate
6888

6989
```php
70-
$products = $client->support()->products();
90+
$products = $client->support->products();
7191

72-
// request Comodo EssentialSSL certificate for 1 year
73-
$request = $client->request()->create($products[1]->id, 1, '<csr_string>', 'EMAIL')
92+
// request Sectigo EssentialSSL certificate for 1 year
93+
$request = $client->requests->create($products[1]->id, 1, '<csr_string>', DCVTypes::EMAIL_VALIDATION)
7494
->setAddress("Address")
7595
->setApproverFirstName("FirstName")
7696
->setApproverLastName("LastName")
@@ -79,82 +99,82 @@ $request = $client->request()->create($products[1]->id, 1, '<csr_string>', 'EMAI
7999
->setCity("City")
80100
->setCompany("Company")
81101
->setApproverEmail('[email protected]')
82-
//currently available languages: en, de, fr, nl
83-
->setLanguage('en')
102+
//currently available languages defined in RequestLanguages
103+
->setLanguage(RequestLanguage::ENGLISH)
84104
->addSubjectAlternativeNames('test1.domain.com')
85105
->addSubjectAlternativeNames('test2.domain.com')
86106
->addSubjectAlternativeNames('test3.domain.com')
87-
->addDcv(new \Xolphin\Requests\RequestDCV('test1.domain.com', 'EMAIL', '[email protected]'))
88-
->addDcv(new \Xolphin\Requests\RequestDCV('test2.domain.com', 'EMAIL', '[email protected]'));
107+
->addDcv(new \Xolphin\Requests\DCVDomain('test1.domain.com', DCVTypes::EMAIL_VALIDATION, '[email protected]'))
108+
->addDcv(new \Xolphin\Requests\DCVDomain('test2.domain.com', DCVTypes::EMAIL_VALIDATION, '[email protected]'));
89109

90-
$client->request()->send($request);
110+
$client->requests->send($request);
91111
```
92112

93113
#### Reissue certificate
94114

95115
```php
96116
// Reissue a current certificate
97-
$reissue = new \Xolphin\Requests\Reissue('<csr_string>', 'EMAIL');
117+
$reissue = new \Xolphin\Requests\Reissue('<csr_string>', DCVTypes::EMAIL_VALIDATION);
98118
$reissue->setApproverEmail('[email protected]');
99119

100-
$client->certificate()->reissue(<certificate_id>, $reissue);
120+
$client->certificates->reissue(<certificate_id>, $reissue);
101121
```
102122

103123
#### Renew certificate
104124

105125
```php
106126
// Renew a current certificate
107-
$currentCertificate = $client->certificate()->get(<certificate_id>);
127+
$currentCertificate = $client->certificates->get(<certificate_id>);
108128

109-
$renew = new \Xolphin\Requests\Renew($currentCertificate->product, <years>, '<csr_string>', 'FILE');
129+
$renew = new \Xolphin\Requests\Renew($currentCertificate->product, <years>, '<csr_string>', DCVTypes::FILE_VALIDATION);
110130
$renew->setApproverEmail('[email protected]');
111131

112-
$client->certificate()->renew(<certificate_id>, $renew)
132+
$client->certificates->renew(<certificate_id>, $renew);
113133
```
114134

115135
#### Create a note
116136

117137
```php
118-
$result = $client->request()->sendNote(1234,'My message');
138+
$result = $client->requests->sendNote(1234,'My message');
119139
```
120140

121141
#### Get list of notes
122142

123143
```php
124-
$notes = $client->request()->getNotes(1234);
144+
$notes = $client->requests->getNotes(1234);
125145
foreach($notes as $note){
126-
echo $note->messageBody . "\n";
146+
echo $note->messageBody . PHP_EOL;
127147
}
128148
```
129149

130-
#### Send a "Comodo Subscriber Agreement" email
150+
#### Send a "Sectigo Subscriber Agreement" email
131151

132152
```php
133-
//currently available languages: en, de, fr, nl
134-
$client->request()->sendComodoSAEmail(1234, '[email protected]', 'en');
153+
//currently available languages defined in RequestLanguages
154+
$client->requests->sendSectigoSAEmail(1234, '[email protected]', RequestLanguage::ENGLISH);
135155
```
136156

137157
#### Request an "Encryption Everywhere" certificate
138158
```php
139-
$request = $this->_client->request()->createEE();
159+
$request = $this->_client->requests->createEE();
140160
$request->setCsr(<csr_string>);
141161
$request->setApproverEmail('[email protected]');
142162
$request->setApproverFirstName('FirstName');
143163
$request->setApproverLastName('SecondName');
144164
$request->setApproverPhone(+12345678901);
145-
$request->setDcvType('FILE');
165+
$request->setDcvType(DCVTypes::FILE_VALIDATION);
146166
// if you just want to validate
147167
$request->setValidate(true);
148168

149-
$response = $this->_client->request()->sendEE($request);
169+
$response = $client->requests->sendEE($request);
150170
```
151171

152172
### Certificate
153173

154174
#### Certificates list and expirations
155175

156176
```php
157-
$certificates = $client->certificate()->all();
177+
$certificates = $client->certificates->all();
158178
foreach($certificates as $certificate) {
159179
echo $certificate->id . ' - ' . $certificate->isExpired() . "\n";
160180
}
@@ -163,8 +183,8 @@ foreach($certificates as $certificate) {
163183
#### Download certificate
164184

165185
```php
166-
$certificates = $client->certificate()->all();
167-
$cert = $client->certificate()->download($certificates[0]->id);
186+
$certificates = $client->certificates->all();
187+
$cert = $client->certificates->download($certificates[0]->id, CertificateDownloadTypes::CRT);
168188
file_put_contents('cert.crt', $cert);
169189
```
170190

@@ -173,7 +193,7 @@ file_put_contents('cert.crt', $cert);
173193
#### List of products
174194

175195
```php
176-
$products = $client->support()->products();
196+
$products = $client->support->products();
177197
foreach($products as $product) {
178198
echo $product->id . "\n";
179199
}
@@ -182,6 +202,25 @@ foreach($products as $product) {
182202
#### Decode CSR
183203

184204
```php
185-
$csr = $client->support()->decodeCSR('<your csr string>');
205+
$csr = $client->support->decodeCSR('<your csr string>');
186206
echo $csr->type;
187207
```
208+
209+
### Invoices
210+
211+
#### List of invoices
212+
213+
```php
214+
$invoices = $client->invoices->all();
215+
foreach($invoices as $invoice) {
216+
echo $invoice->id . ' ' . $invoice->invoiceNr . ' ' . $invoice->amount . "\n";
217+
}
218+
```
219+
220+
#### Download Invoice in PDF format
221+
222+
```php
223+
$invoices = $client->invoices->all();
224+
$invoicePdf = $client->invoices->download($invoices[0]->id, InvoiceDownloadTypes::PDF);
225+
file_put_contents('invoice.pdf' , $invoicePdf);
226+
```

0 commit comments

Comments
 (0)