Skip to content

Commit e9b3821

Browse files
committed
Upgrade to ACME RFC (v2)
1 parent 6bfa43d commit e9b3821

6 files changed

Lines changed: 721 additions & 307 deletions

File tree

bin/acme

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/usr/bin/env php
22
<?php
33

4+
use Amp\Http\Client\HttpClientBuilder;
45
use Amp\Loop;
56
use Auryn\Injector;
67
use Kelunik\AcmeClient\AcmeFactory;
8+
use Kelunik\AcmeClient\Commands\Command;
79
use League\CLImate\CLImate;
10+
use function Kelunik\AcmeClient\getBinary;
11+
use function Kelunik\AcmeClient\suggestCommand;
812

913
$logo = <<<LOGO
1014
____ __________ ___ ___
@@ -51,7 +55,7 @@ $commands = [
5155
'help' => 'Print this help information.',
5256
];
5357

54-
$binary = \Kelunik\AcmeClient\getBinary();
58+
$binary = getBinary();
5559

5660
$help = implode(PHP_EOL, array_map(function ($command) use ($commands) {
5761
$help = " <green>{$command}</green>\n";
@@ -81,8 +85,8 @@ if (!in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
8185
exit(1);
8286
}
8387

84-
if (PHP_VERSION_ID < 70000) {
85-
$climate->yellow("You're using an older version of PHP which is no longer supported by this client. Have a look at http://php.net/supported-versions.php and upgrade at least to PHP 7.0!");
88+
if (PHP_VERSION_ID < 70400) {
89+
$climate->yellow("You're using an older version of PHP which is no longer supported by this client. Have a look at https://php.net/supported-versions.php and upgrade at least to PHP 7.4!");
8690
$climate->br(2);
8791
}
8892

@@ -94,7 +98,7 @@ if (count($argv) === 1 || in_array($argv[1], ['-h', 'help', '--help'], true)) {
9498
if (!array_key_exists($argv[1], $commands)) {
9599
$climate->error("Unknown command '{$argv[1]}'. Use --help for a list of available commands.");
96100

97-
$suggestion = \Kelunik\AcmeClient\suggestCommand($argv[1], array_keys($commands));
101+
$suggestion = suggestCommand($argv[1], array_keys($commands));
98102

99103
if ($suggestion) {
100104
$climate->br()->out(" Did you mean '$suggestion'?");
@@ -105,7 +109,7 @@ if (!array_key_exists($argv[1], $commands)) {
105109
exit(1);
106110
}
107111

108-
/** @var \Kelunik\AcmeClient\Commands\Command $class */
112+
/** @var string|Command $class */
109113
$class = "Kelunik\\AcmeClient\\Commands\\" . ucfirst($argv[1]);
110114
$definition = $class::getDefinition();
111115

@@ -136,7 +140,7 @@ try {
136140
$injector = new Injector;
137141
$injector->share($climate);
138142
$injector->share(new AcmeFactory);
139-
$injector->share(new Amp\Artax\DefaultClient);
143+
$injector->share(HttpClientBuilder::buildDefault());
140144

141145
$command = $injector->make($class);
142146
$exitCode = 1;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"config": {
4848
"platform": {
49-
"php": "7.2.5"
49+
"php": "7.4.0"
5050
}
5151
},
5252
"extra": {

0 commit comments

Comments
 (0)