Skip to content

This is a PHP library to help developers include SMS service, with Intouchsms gateway from Rwanda

License

Notifications You must be signed in to change notification settings

aimedidierm/intouchsms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aimedidierm/intouchsms

Source Code Latest Version Software License PHP Version Build Status Coverage Status Total Downloads

This is a php library to help developers include sms service, with IntouchSms gateway from RWANDA

Installation

Install this package as a dependency using Composer.

composer require aimedidierm/intouchsms

Usage

This is the documantion

use Aimedidierm\IntouchSms\SmsSimple;

/** @var \Aimedidierm\IntouchSms\SmsSimple */
$sms = new SmsSimple();
$sms->recipients(["250788750979","0738584462"])
    ->message("Hello world")
    ->sender("intouchSenderId")
    ->username("intouchUsername")
    ->password("intouchPassword")
    ->apiUrl("www.intouchsms.co.rw/api/sendsms/.json")
    ->callBackUrl("");
print_r($sms->send());

That code works well, however it does call some static parameters such as senderId,Username,Password,ApiUrl and CallbackUrl. we can solve this by creating another class Called Sms which extends SmsAbstract

namespace App\Services;

use Aimedidierm\IntouchSms\SmsAbstract;

class Sms extends SmsAbstract
{
    public function __construct()
    {
        parent::__construct();

        //
    }

    public function configSender(): string
    {
        return "intouchSenderId";
    }

    public function configUsername(): string
    {
        return "intouchUsername";
    }

    public function configPassword(): string
    {
        return "intouchPassword";
    }

    public function configApiUrl(): string
    {
        return "www.intouchsms.co.rw/api/sendsms/.json";
    }

    public function configCallBackUrl(): string
    {
        return "";
    }


    public static function QuickSend($recipients, String $message, String $senderId = null)
    {
        $sms = new Sms();
        $sms->requiredData($recipients, $message, $senderId);
        return $sms->send();
    }
}

After creating this class you can now use simple codes like

$sms = new Sms();
// first parameter is recipients and second one is message
$sms->requiredData(["250788750979","0738584462"], "Hello there");
print_r($sms->send());

NB: For some people who are not using composer remember to add:

include_once("../vendor/autoload.php");

Contributing

Contributions are welcome! Before contributing to this project, familiarize yourself with CONTRIBUTING.md.

To develop this project, you will need PHP 8.0 or greater, Composer,

After cloning this repository locally, execute the following commands:

cd /path/to/repository
composer install

Now, you are ready to develop!

Copyright and License

This libraly is licensed under the MIT License - see the LICENSE file for details.

About

This is a PHP library to help developers include SMS service, with Intouchsms gateway from Rwanda

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages