2017 © Pedro Peláez
 

library sms-clients

SMS Abstraction; Implementing Iranian SMS Service Providers; [persian sms, iran sms, magfa].

image

poirot/sms-clients

SMS Abstraction; Implementing Iranian SMS Service Providers; [persian sms, iran sms, magfa].

  • Wednesday, January 24, 2018
  • by Payam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 124 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Sms API Clients And Poirot Sms Module

SMS Abstraction; Implementing Iranian SMS Service Providers., (*1)

  • One Abstraction Interface, Many Providers
  • Entity Model For SMS Message Has To Be Sent And Sent Message
  • Sent Message Is Serializable Include Receptors and Contributor Number
  • Good Object Oriented Design Achieve Ability To Use Multiple Platform (rest, soap, ..) For Each Provider
  • Simple Usage And Easy To Understand
  • Can Be Used in Poirot Module Ecosystem

Poirot Module

Configuration Settings

return [
    \Module\SmsClients\Module::CONF_KEY =>
    [
        \Module\SmsClients\Services\ServiceSmsClient::CONF_CLIENT => [
            // 'service' => '/Registered/ServiceName'
            // 'service' => iClientOfSms
               // instance() let ioc to inject dependencies if required
               'service' => new \Poirot\Ioc\instance(
                   \Poirot\Sms\Driver\KavehNegar\Sms::class
                   , [
                       'api_key'  => 'your_api_key',
                       'platform' => new \Poirot\Ioc\instance(
                           \Poirot\Sms\Driver\KavehNegar\Rest\PlatformRest::class
                       )
                   ]
               ),
        ],
    ],
];

Usage

// Every Where In Project

$sentSms = \Module\SmsClients\Services\IOC::Sms()->sendTo(...)

Providers

Kaveh Negar

http://kavenegar.com/, (*2)

$sms = new Poirot\Sms\Driver\KavehNegar\Sms([
    'api_key'     => 'your_api_key',
    'sender_line' => '10007770070777'
]);

try {
    $sentMessage = $sms->sendTo(['0935xxxxxxx'], new SMSMessage('Hello ...'));
} catch (exAuthNoCredit $e) {
    // There is no left credit
    echo '﷼'.$sms->getRemainCredit();
    die();
}

// unique message id 
$messageId = $sentMessage->getUid();

if ($sentMessage->getStatus() === $sentMessage::STATUS_BANNED)
    die('User Has Banned SMS Messaging!!');

if ($sentMessage->getStatus() === $sentMessage::STATUS_FAILED)
    die('SMS Sent Successfuly But Failed Sending From Telecommunication!!');


// Sent Message is Serializable And Can Be Stored
$myPersitence->store($sentMessage);

// Later We Can Check The Status Of Message
$sentMessage = $sms->getSentMessageWithId($messageId);

Exceptions

  • exAuthentication
  • exAuthNoCredit
  • exMessageMalformed
  • exServerBan
  • exServerError

The Versions

24/01 2018

dev-devel

dev-devel

SMS Abstraction; Implementing Iranian SMS Service Providers; [persian sms, iran sms, magfa].

  Sources   Download

The Requires

 

by Payam Naderi

10/05 2017

dev-master

9999999-dev

SMS Abstraction; Implementing Iranian SMS Service Providers; [persian sms, iran sms, magfa].

  Sources   Download

The Requires

 

by Payam Naderi