Skip to content

Commit

Permalink
readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Apr 7, 2024
1 parent eeb33fd commit 25af914
Show file tree
Hide file tree
Showing 3 changed files with 414 additions and 67 deletions.
239 changes: 206 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,232 @@
# This is my package bell
# Laraflow/SMS

[![Latest Version on Packagist](https://img.shields.io/packagist/v/fintech/bell.svg?style=flat-square)](https://packagist.org/packages/fintech/bell)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/fintech/bell/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/fintech/bell/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/fintech/bell/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/fintech/bell/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/fintech/bell.svg?style=flat-square)](https://packagist.org/packages/fintech/bell)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/laraflow/sms.svg?style=flat-square)](https://packagist.org/packages/laraflow/sms)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/laraflow/sms/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/laraflow/sms/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/laraflow/sms/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/laraflow/sms/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/laraflow/sms.svg?style=flat-square)](https://packagist.org/packages/laraflow/sms)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/Bell.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/Bell)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
**Laraflow/SMS** is a fast and lightweight sms channel collection for laravel application. This package allow users to integrate different **SMS** gateway api without any hassle.

## Installation

You can install the package via composer:

```bash
composer require fintech/bell
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="bell-migrations"
php artisan migrate
composer require laraflow/sms
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="bell-config"
php artisan vendor:publish --tag="sms-config"
```

This is the contents of the published config file:

```php
return [
];
```

Optionally, you can publish the views using
/*
|--------------------------------------------------------------------------
| Response Logger
|--------------------------------------------------------------------------
| this configuration is for debugging purpose. if enabled then program will log
| sms vendor response in debug category.
*/
'log' => (bool) env('SMS_LOG', env('APP_DEBUG', false)),

```bash
php artisan vendor:publish --tag="bell-views"
/*
|--------------------------------------------------------------------------
| Default Vendor
|--------------------------------------------------------------------------
| this configuration is used to tell system which vendor
| should be used when sending the sms.
| Note: if set null package will use laravel default log driver.
*/
'default' => env('SMS_DRIVER', null),

/*
|--------------------------------------------------------------------------
| Vendor Account Mode
|--------------------------------------------------------------------------
| this configuration is used to tell system which vendor account
| mode should be used when sending the sms. Available options are
| "sandbox" or "live".
*/
'mode' => env('SMS_ACCOUNT_MODE', null),

/*
|--------------------------------------------------------------------------
| SMS Sender Name
|--------------------------------------------------------------------------
| this configuration is used to tell system what value will be used
| if sms vendor support sms name masking
| "sandbox" or "live".
*/
'from' => env('SMS_FROM_NAME', env('APP_NAME', 'Laravel')),

/*
|--------------------------------------------------------------------------
| Vendor Configuration
|--------------------------------------------------------------------------
|
| This value will be added to all your routes from this package
| Example: APP_URL/{root_prefix}/api/bell/action
|
| Note: while adding prefix add closing ending slash '/'
*/
'vendors' => [
'africastalking' => [
'driver' => \Laraflow\Sms\Drivers\AfricasTalking::class,
'live' => [
'url' => 'https://api.africastalking.com/version1/messaging',
'apiKey' => env('SMS_AFRICA_TALKING_API_KEY'),
'username' => env('SMS_AFRICA_TALKING_USERNAME'),

],
'sandbox' => [
'url' => 'https://api.sandbox.africastalking.com/version1/messaging',
'apiKey' => env('SMS_AFRICA_TALKING_API_KEY'),
'username' => env('SMS_AFRICA_TALKING_USERNAME'),

],
],
'clickatell' => [
'driver' => \Laraflow\Sms\Drivers\ClickATell::class,
'live' => [
'url' => 'https://platform.clickatell.com/messages/http/send',
'apiKey' => env('SMS_CLICKATELL_API_KEY'),
],
'sandbox' => [
'url' => 'https://platform.clickatell.com/messages/http/send',
'apiKey' => env('SMS_CLICKATELL_API_KEY'),
],
],
'clicksend' => [
'driver' => \Laraflow\Sms\Drivers\ClickSend::class,
'live' => [
'url' => 'https://rest.clicksend.com/v3/sms/send',
'username' => env('SMS_CLICKSEND_USERNAME'),
'password' => env('SMS_CLICKSEND_PASSWORD'),

],
'sandbox' => [
'url' => 'https://rest.clicksend.com/v3/sms/send',
'username' => env('SMS_CLICKSEND_USERNAME'),
'password' => env('SMS_CLICKSEND_PASSWORD'),
],
],
'infobip' => [
'driver' => \Laraflow\Sms\Drivers\Infobip::class,
'live' => [
'url' => 'https://mmk314.api.infobip.com/sms/2/text/advanced',
'token' => env('SMS_INFOBIP_API_TOKEN'),
],
'sandbox' => [
'url' => 'https://mmk314.api.infobip.com/sms/2/text/advanced',
'token' => env('SMS_INFOBIP_API_TOKEN'),
],
],
'messagebird' => [
'driver' => \Laraflow\Sms\Drivers\MessageBird::class,
'live' => [
'url' => 'https://rest.messagebird.com/messages',
'access_key' => env('SMS_MESSAGE_BIRD_ACCESS_KEY'),
],
'sandbox' => [
'url' => 'https://rest.messagebird.com/messages',
'access_key' => env('SMS_MESSAGE_BIRD_ACCESS_KEY'),
],
],
'smsbroadcast' => [
'driver' => \Laraflow\Sms\Drivers\SmsBroadcast::class,
'live' => [
'url' => 'https://api.smsbroadcast.com.au/api-adv.php',
'username' => env('SMS_SMSBROADCAST_USERNAME'),
'password' => env('SMS_SMSBROADCAST_PASSWORD'),
],
'sandbox' => [
'url' => 'https://api.smsbroadcast.com.au/api-adv.php',
'username' => env('SMS_SMSBROADCAST_USERNAME'),
'password' => env('SMS_SMSBROADCAST_PASSWORD'),
],
],
'telnyx' => [
'driver' => \Laraflow\Sms\Drivers\Telnyx::class,
'live' => [
'url' => 'https://api.telnyx.com/v2/messages',
'token' => env('SMS_TELNYX_API_TOKEN'),
],
'sandbox' => [
'url' => 'https://api.telnyx.com/v2/messages',
'token' => env('SMS_TELNYX_API_TOKEN'),
],
],
'twilio' => [
'driver' => \Laraflow\Sms\Drivers\Twilio::class,
'live' => [
'url' => 'https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID$/Messages.json',
'username' => env('SMS_TWILIO_USERNAME'),
'password' => env('SMS_TWILIO_PASSWORD'),

],
'sandbox' => [
'url' => 'https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID$/Messages.json',
'username' => env('SMS_TWILIO_USERNAME'),
'password' => env('SMS_TWILIO_PASSWORD'),

],
],
],
];
```

## Usage

Please follow this steps and you are live with in a mere seconds.

### First

On notification classes add SMS channel on the like this.

```php
$bell = new Fintech\Bell();
echo $bell->echoPhrase('Hello, Fintech!');
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['sms'];
}
```

## Testing
### Second

```bash
composer test
On the `.env` file please add this configuration.

```shell
SMS_LOG=false
SMS_DRIVER="twilio"
SMS_ACCOUNT_MODE="sandbox"
SMS_FROM_NAME="${APP_NAME}"
```

### Last

Depending on driver option you choose, add those API credentials to existing variables.

| Driver | Credentials |
|------------------|-------------------------------------------------------------------------|
| `africastalking` | `SMS_AFRICA_TALKING_API_KEY=null`<br>`SMS_AFRICA_TALKING_USERNAME=null` |
| `clickatell` | `SMS_CLICKATELL_API_KEY=null` |
| `clicksend` | `SMS_CLICKSEND_USERNAME=null`<br>`SMS_CLICKSEND_PASSWORD=null` |
| `infobip` | `SMS_INFOBIP_API_TOKEN=null` |
| `messagebird` | `SMS_MESSAGE_BIRD_ACCESS_KEY=null` |
| `smsbroadcast` | `SMS_SMSBROADCAST_USERNAME=null`<br>`SMS_SMSBROADCAST_PASSWORD=null` |
| `telnyx` | `SMS_TELNYX_API_TOKEN=null` |
| `twilio` | `SMS_TWILIO_USERNAME=null`<br>`SMS_TWILIO_PASSWORD=null` |

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand All @@ -83,3 +248,11 @@ Please review [our security policy](../../security/policy) on how to report secu
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[//]: # (## Support us)

[//]: # ()
[//]: # (We invest a lot of resources into creating [best in class open source packages]&#40;https://spatie.be/open-source&#41;. You can support us by [buying one of our paid products]&#40;https://spatie.be/open-source/support-us&#41;.)

[//]: # ()
[//]: # (We highly appreciate you sending us a postcard from your hometown, mentioning which of our package&#40;s&#41; you are using. You'll find our address on [our contact page]&#40;https://spatie.be/about-us&#41;. We publish all received postcards on [our virtual postcard wall]&#40;https://spatie.be/open-source/postcards&#41;.)
Loading

0 comments on commit 25af914

Please sign in to comment.