From 6ec5ff920f29dfe7cc586d313d00969b3f6e46ee Mon Sep 17 00:00:00 2001 From: "Devdutta Bain (S540)" Date: Sat, 19 Sep 2020 10:09:26 +0530 Subject: [PATCH] Adding Guzzle verify option into the constructor Adding Guzzle verify option into the constructor. In some local environment people get 'cURL error 60: SSL certificate problem'. that can be avoided with this option. ``` $guzzleVerify = config('laravel-msg91.guzzle_verify', true); $this->guzzle = new GuzzleClient(["base_uri" => $base_uri, "verify" => $guzzleVerify]); ``` And to the config file... ``` /* Guzzle Verify, if false there'll be no ssl checking (optional) */ 'guzzle_verify' => env('MSG91_GUZZLE_VERIFY', true), ``` --- src/LaravelMsg91.php | 5 ++++- src/config/config.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/LaravelMsg91.php b/src/LaravelMsg91.php index 84e8cda..38ba440 100755 --- a/src/LaravelMsg91.php +++ b/src/LaravelMsg91.php @@ -65,7 +65,10 @@ public function __construct(){ $this->limit_credit = config('laravel-msg91.limit_credit'); $this->country = config('laravel-msg91.country'); $base_uri = config('laravel-msg91.base_uri') ? config('laravel-msg91.base_uri') : 'https://control.msg91.com/api/'; - $this->guzzle = new GuzzleClient(["base_uri" => $base_uri ]); + + //reading verify option from config, and passing that to the guzzle options + $guzzleVerify = config('laravel-msg91.guzzle_verify', true); + $this->guzzle = new GuzzleClient(["base_uri" => $base_uri, "verify" => $guzzleVerify]); } diff --git a/src/config/config.php b/src/config/config.php index 24d714f..f50c212 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -19,4 +19,7 @@ /* Credit limit, if true message will be limted to 1 credit (optional) */ 'limit_credit' => env('MSG91_LIMIT_CREDIT', false), + /* Guzzle Verify, if false there'll be no ssl checking (optional) */ + 'guzzle_verify' => env('MSG91_GUZZLE_VERIFY', true), + ); \ No newline at end of file