Skip to content

Commit

Permalink
feat: add env aware
Browse files Browse the repository at this point in the history
  • Loading branch information
alphaolomi committed May 13, 2021
1 parent b695852 commit 43376f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NextSMS notification channel for Laravel

[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/nextsms.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/nextsms)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/nextsms/laravel.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/nextsms)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![PHPUnit tests](https://github.com/nextsms/laravel-nextsms/actions/workflows/tests.yml/badge.svg)](https://github.com/nextsms/laravel-nextsms/actions/workflows/tests.yml)

Expand Down Expand Up @@ -40,8 +40,9 @@ You will need to [Register](https://nextsms.co.tz/register/).
```bash
AFRICASTALKING_USERNAME=""
AFRICASTALKING_KEY=""
AFRICASTALKING_PASSWORD=""
AFRICASTALKING_FROM=""
AFRICASTALKING_ENVIROMENT="production"
```

You can publish the package configuration file:
Expand Down
6 changes: 6 additions & 0 deletions config/nextsms.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@
*
*/
'from' => env('NEXTSMS_FROM'),

/*
* Enviroment from NextSMS
*
*/
'enviroment' => env('NEXTSMS_ENVIROMENT'),
];
7 changes: 6 additions & 1 deletion src/NextSmsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ public function boot()
->give(function () {
$username = config('nextsms.username');
$password = config('nextsms.password');
$enviroment = config('nextsms.enviroment', 'production');

if (is_null($username) || is_null($password)) {
throw InvalidConfiguration::configurationNotSet();
}

return new NextSmsSDK(['username' => $username, 'password' => $password]);
return new NextSmsSDK([
'username' => $username,
'password' => $password,
'enviroment' => $enviroment
]);
});
}

Expand Down

0 comments on commit 43376f3

Please sign in to comment.