Coder Social home page Coder Social logo

powersms-gateway's Introduction

PowerSMS Gateway PHP Package

The PowerSMS Gateway PHP Package allows you to easily send bulk SMS messages using the Power SMS service provided by Banglaphone Limited. This package is compatible with both Laravel and raw PHP applications, making it versatile for various use cases.

Installation

You can install this package via Composer:

composer require sagordev/powersms-gateway

Laravel Integration

For Laravel integration, follow these additional steps:

Publish the package configuration file:

 php artisan vendor:publish --provider="Sagordev\PowersmsGateway\Providers\PowerSmsGatewayServiceProvider"

This will publish the configuration file to config/powersms.php

Add your Power SMS API credentials and configure other settings in the config/powersms.php file:

return [
    'user_id' => 'YOUR_USER_ID',
    'password' => 'YOUR_PASSWORD',
    'url' => '' // You can keep it blank
];

Usage

Sending SMS

use Sagordev\PowersmsGateway\Facades\PowerSms;

PowerSms::message('This is a test SMS', '01234567890')->send();
// You can also send list of numbers (ex: ['01234567890', '01234567891'])

Sending Same SMS to multiple recipients

PowerSms::message('This is test SMS')
        ->to(['01234567890', '01234567891'])
        ->send();

Add your number(s) in cc to get a carbon copy of message

PowerSms::message('I am SMS with carbon copy to developer')
        ->to(['01234567890', '01234567891'])
        ->cc(['01234567892'])
        ->send();

Another way to send single SMS to multiple recipients

PowerSms::send([
    'message' => 'Hey, This is another SMS',
    'to' => ['01234567890', '01234567891'],
]);

Send Multiple messages to multiple different recipients

PowerSms::send([
      [
          'message' => 'Dear Customer, Your invitation code is #3310',
          'to' => ['01234567890', '01234567891'],
      ],
      [
          'message' => 'Dear Customer, Your invitation code is #0950',
          'to' => '01234567892',
      ]
]);

In your other PHP project

use Sagordev\PowersmsGateway\PowerSms;

$config = [
    'user_id' => 'YOUR_USER_ID',
    'password' => 'YOUR_PASSWORD',
    'url' => '' // You can keep it blank
];

$sms = new PowerSms($config);
$sms->message('Hello', '01234567890')->send();

// Example 2
$sms->message('I am SMS with carbon copy to developer')
        ->to(['01234567890', '01234567891'])
        ->cc(['01234567892'])
        ->send();
// Please look at the previous examples for more fun

Support and Issues

If you encounter any issues or have questions about using this package, please feel free to create an issue on the GitHub repository. I am here to help!

License

This package is open-sourced software licensed under the MIT License.

powersms-gateway's People

Contributors

sagordev avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.