Skip to content

Commit d16bccd

Browse files
committed
🔒 feat: Add SSL verification option
- Allows disabling SSL verification for requests. - Updates composer.json to version 1.0.2. - Introduces setVerifySSL method to toggle SSL verification.
1 parent 39119d4 commit d16bccd

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"keywords": ["rest","client","http client"],
55
"homepage": "https://github.com/ay4t/php-rest-client",
66
"type": "library",
7-
"version": "1.0.1.0",
7+
"version": "1.0.2",
88
"require": {
99
"guzzlehttp/guzzle": "^7.9.2"
1010
},

src/Abstracts/AbstractClient.php

+24-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,33 @@ abstract class AbstractClient implements ClientInterface
1111
protected $client;
1212
protected $config;
1313

14+
/**
15+
* @var bool
16+
*/
17+
protected $verifySSL = true;
18+
1419
public function __construct(Config $config)
1520
{
1621
$this->config = $config;
17-
$this->client = new GuzzleClient(['base_uri' => $config->getBaseUri()]);
22+
$this->client = new GuzzleClient([
23+
'base_uri' => $config->getBaseUri(),
24+
'verify' => $this->verifySSL
25+
]);
26+
}
27+
28+
/**
29+
* Set SSL verification
30+
* @param bool $verify
31+
* @return self
32+
*/
33+
public function setVerifySSL(bool $verify): self
34+
{
35+
$this->verifySSL = $verify;
36+
$this->client = new GuzzleClient([
37+
'base_uri' => $this->config->getBaseUri(),
38+
'verify' => $this->verifySSL
39+
]);
40+
return $this;
1841
}
1942

2043
protected function prepareHeaders(): array

0 commit comments

Comments
 (0)