File tree Expand file tree Collapse file tree 4 files changed +28
-3
lines changed
Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ php artisan vendor:publish --provider="NotificationChannels\Smsapi\SmsapiService
4141
4242### Setting up the Smsapi service
4343
44- Log in to your [ Smsapi dashboard] ( https://ssl.smsapi.pl/ ) and configure your preferred authentication method.
44+ Log in to your Smsapi dashboard and configure your preferred authentication method. There is a
45+ [ polish version] ( https://ssl.smsapi.pl/ ) and an [ international version] ( https://ssl.smsapi.com/ )
46+ which have separated accounts.
4547Set your credentials and defaults in ` config/smsapi.php ` :
4648
4749``` php
@@ -53,6 +55,8 @@ Set your credentials and defaults in `config/smsapi.php`:
5355 // 'username' => env('SMSAPI_AUTH_USERNAME'),
5456 // 'password' => env('SMSAPI_AUTH_PASSWORD'), // Hashed by MD5
5557 ],
58+ // Service of smsapi. Can be SmsapiClient::SERVICE_PL or SmsapiClient::SERVICE_COM.
59+ 'service' => SmsapiClient::SERVICE_PL,
5660],
5761'defaults' => [
5862 'common' => [
Original file line number Diff line number Diff line change 11<?php
22
3+ use NotificationChannels \Smsapi \SmsapiClient ;
4+
35return [
46 'auth ' => [
57 /*
1820 // 'username' => env('SMSAPI_AUTH_USERNAME'),
1921 // 'password' => env('SMSAPI_AUTH_PASSWORD'), // Hashed by MD5
2022 ],
23+
24+ /*
25+ |----------------------------------------------------------------------
26+ | SMSAPI service type
27+ |----------------------------------------------------------------------
28+ | SMSAPI runs a polish service on smsapi.pl and a international service
29+ | on smsapi.com. This option will set which version will be used.
30+ |
31+ | Supported: "SmsapiClient::SERVICE_PL", "SmsapiClient::SERVICE_COM".
32+ |
33+ */
34+ 'service ' => SmsapiClient::SERVICE_PL ,
2135 ],
2236
2337 /*
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ class SmsapiClient
2626 */
2727 protected $ proxy ;
2828
29+ public const SERVICE_PL = 'https://api.smsapi.pl ' ;
30+
31+ public const SERVICE_COM = 'https://api.smsapi.com ' ;
32+
2933 /**
3034 * @param Client $client
3135 * @param array $defaults
Original file line number Diff line number Diff line change 55use Illuminate \Support \Arr ;
66use Illuminate \Support \ServiceProvider ;
77use SMSApi \Client ;
8+ use SMSApi \Proxy \Http \Native ;
89
910class SmsapiServiceProvider extends ServiceProvider
1011{
@@ -17,7 +18,7 @@ public function boot()
1718 ->needs (SmsapiClient::class)
1819 ->give (function () {
1920 $ config = config ('smsapi ' );
20- $ auth = $ config ['auth ' ];
21+ $ auth = $ config ['auth ' ] + [ ' service ' => SmsapiClient:: SERVICE_PL ] ;
2122 if ($ auth ['method ' ] === 'token ' ) {
2223 $ client = Client::createFromToken ($ auth ['credentials ' ]['token ' ]);
2324 } elseif ($ auth ['method ' ] === 'password ' ) {
@@ -54,7 +55,9 @@ public function boot()
5455 });
5556 }, $ defaults );
5657
57- return new SmsapiClient ($ client , $ defaults );
58+ $ proxy = new Native ($ auth ['service ' ]);
59+
60+ return new SmsapiClient ($ client , $ defaults , $ proxy );
5861 });
5962
6063 if ($ this ->app ->runningInConsole ()) {
You can’t perform that action at this time.
0 commit comments