Issues (18)

examples/exampleDNSFinish.php (3 issues)

1
<?php
2
namespace Elphin\LEClient;
3
4
require_once(__DIR__.'/../vendor/autoload.php');
5
6
//Sets the maximum execution time to two minutes, to be sure.
7
ini_set('max_execution_time', 120);
8
9
// Listing the contact information in case a new account has to be created.
10
$email = array('[email protected]');
11
// Defining the base name for this order
12
$basename = 'example.org';
13
// Listing the domains to be included on the certificate
14
$domains = array('example.org', 'test.example.org');
15
16
$email = ['[email protected]'];
17
$basename = 'le.dixo.net';
18
$domains=['le.dixo.net'];
19
20
$logger = new DiagnosticLogger;
0 ignored issues
show
The type Elphin\LEClient\DiagnosticLogger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
// Initiating the client instance. In this case using the staging server (argument 2) and outputting all status and
23
// debug information (argument 3).
24
$client = new LEClient($email, true, $logger);
0 ignored issues
show
The type Elphin\LEClient\LEClient was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
// Initiating the order instance. The keys and certificate will be stored in /example.org/ (argument 1) and the domains
26
// in the array (argument 2) will be on the certificate.
27
$order = $client->getOrCreateOrder($basename, $domains);
28
// Check whether there are any authorizations pending. If that is the case, try to verify the pending authorizations.
29
if(!$order->allAuthorizationsValid())
30
{
31
	// Get the DNS challenges from the pending authorizations.
32
	$pending = $order->getPendingAuthorizations(LEOrder::CHALLENGE_TYPE_DNS);
0 ignored issues
show
The type Elphin\LEClient\LEOrder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
	// Walk the list of pending authorization DNS challenges.
34
	if(!empty($pending))
35
	{
36
		foreach($pending as $challenge)
37
		{
38
			// Let LetsEncrypt verify this challenge, which should have been fulfilled in exampleDNSStart.php.
39
			$order->verifyPendingOrderAuthorization($challenge['identifier'], LEOrder::CHALLENGE_TYPE_DNS);
40
		}
41
	}
42
}
43
// Check once more whether all authorizations are valid before we can finalize the order.
44
if($order->allAuthorizationsValid())
45
{
46
	// Finalize the order first, if that is not yet done.
47
	if(!$order->isFinalized()) $order->finalizeOrder();
48
	// Check whether the order has been finalized before we can get the certificate. If finalized, get the certificate.
49
	if($order->isFinalized()) $order->getCertificate();
50
51
	//finally, here's how we revoke
52
    //echo "REVOKING...\n";
53
    //$order->revokeCertificate();
54
}
55
56
57
echo "\nDiagnostic logs\n";
58
$logger->dumpConsole();
59