Skip to content

Commit

Permalink
Merge pull request #4 from olotintemitope/feature/update-readme-and-c…
Browse files Browse the repository at this point in the history
…onfig

Feature/update readme and config
  • Loading branch information
Mujhtech committed Oct 3, 2022
2 parents aa68260 + 42c1496 commit f0ea933
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 226 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ return [
* live or test
*
*/
'mode' => 'test',
'mode' => 'live', // test mode has been removed, the user must buy testing credit on the platform

/**
* Public Key
Expand All @@ -81,6 +81,20 @@ return [
];
```

## Lumen Configuration
- Open your bootstrap/app.php
- Register your service provider
- Add your Facade
- Register the config

```php
$app->register(Mujhtech\SendChamp\SendChampServiceProvider::class);
$app->withFacades(true, [
SendChamp::class => 'SendChamp',
]);
$app->configure('sendchamp');
```

## Usage

Open your .env file and add your api key like so:
Expand Down Expand Up @@ -236,14 +250,14 @@ sendchamp()->sendWhatsappOtp($template_code, $message, $sender_number, $recipien
/**
* Send otp message
* @param string $channel
* @param string $token_type
* @param int $token_length
* The length of the token you want to send to your customer. Minimum is 4
* @param string $token_type // numeric or alphanumeric
* @param int $token_length
* The length of the token you want to send to your customer. Minimum is 5
* @param int $expiry_day
* How long you want to the to be active for in minutes. (E.g 10 means 10 minutes )
* How long you want to the to be active for in minutes. (E.g. 10 means 10 minutes )
* @param string $customer_email
* @param string $customer_mobile_number
* @param array $meta_data
* @param array $meta_data can be empty but you need to pass array like ['data' => []]
* @param string $sender
* Specify the sender you want to use. This is important
* when using SMS OR Whatsapp Channel or we will select a
Expand Down Expand Up @@ -276,6 +290,9 @@ sendchamp()->confirmOtp($reference, $otp);

```

## Code Quality
- Run `vendor/bin/pint`

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.4"
"mockery/mockery": "^1.4",
"laravel/pint": "^1.2"
},
"authors": [
{
Expand Down
12 changes: 2 additions & 10 deletions config/sendchamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,29 @@
return [

/**
* Mode
* Mode
* live or test
*
*/
'mode' => 'test',

'mode' => 'live',

/**
* Live API url
*
*/
'baseUrl' => 'https://api.sendchamp.com/api/v1',

/**
* Test Api Url
*
*/
'sandboxUrl' => 'https://sandbox-api.sendchamp.com/api/v1',

/**
* Public Key
*
*/
'publicKey' => getenv('SENDCHAMP_PUBLIC_KEY'),

/**
* Webhook
*
*/
'webhook' => getenv('SENDCHAMP_WEBHOOK'),


];

4 changes: 1 addition & 3 deletions src/Exceptions/SendChampException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php


namespace Mujhtech\SendChamp\Exceptions;

use Exception;

class SendChampException extends Exception
{

}
}
4 changes: 2 additions & 2 deletions src/Facades/SendChamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/


namespace Mujhtech\SendChamp\Facades;

use Illuminate\Support\Facades\Facade;
Expand All @@ -15,10 +14,11 @@ class SendChamp extends Facade
{
/**
* Get the registered name of the component
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'laravel-sendchamp';
}
}
}
9 changes: 4 additions & 5 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
*
*/

if (! function_exists("sendchamp"))
{
function sendchamp() {

if (! function_exists('sendchamp')) {
function sendchamp()
{
return app()->make('laravel-sendchamp');
}
}
}
Loading

0 comments on commit f0ea933

Please sign in to comment.