diff --git a/readme.md b/readme.md index d406482..d788ea4 100644 --- a/readme.md +++ b/readme.md @@ -9,25 +9,22 @@ gateways for Laravel Framework. * [Installation](#installation) - * [Step 1:](#step-1) - * [Step 2:](#step-2) - * [Step 3:](#step-3) - * [Step 4:](#step-4) - * [Usage](#usage) - * [Simply use the facade](#simply-use-the-facade) - * [Or, with facade alias](#or-with-facade-alias) - * [Or, if you need to change the default provider on the fly](#or-if-you-need-to-change-the-default-provider-on-the-fly) - * [Or, if you want to send message with queue. This queue will be added in your jobs table. Message will be sent as soon as job is run.](#or-if-you-want-to-send-message-with-queue-this-queue-will-be-added-in-your-jobs-table-message-will-be-sent-as-soon-as-job-is-run) + * [Step 1:](#step-1) + * [Step 2:](#step-2) + * [Step 3:](#step-3) + * [Step 4:](#step-4) + * [Usage](#usage) + * [Simply use the facade](#simply-use-the-facade) + * [Or, with facade alias](#or-with-facade-alias) + * [Or, if you need to change the default provider on the fly](#or-if-you-need-to-change-the-default-provider-on-the-fly) + * [Or, if you want to send message with queue. This queue will be added in your jobs. Message be sent as soon as job is run.](#or-if-you-want-to-send-message-with-queue-this-queue-will-be-added-in-your-jobs-message-be-sent-as-soon-as-job-is-run) * [Log Generate](#log-generate) * [Sample Code](#sample-code) - * [SSLCommerz](#sslcommerz) - * [Demo Response Using SSL](#demo-response-using-ssl) - * [MimSMS](#mimsms) + * [SSLCommerz](#sslcommerz) + * [Demo Response Using SSL](#demo-response-using-ssl) + * [MimSMS](#mimsms) * [Currently Supported SMS Gateways](#currently-supported-sms-gateways) -* [Stargazers](#stargazers) -* [Forkers](#forkers) -* [Contributors](#contributors) @@ -172,34 +169,37 @@ $status = $sender->send(); # Currently Supported SMS Gateways -| Provider | Credentials Required
For Sending SMS | Status | Comment | Contact | -|-----------------|-------------------------------------------------------------------|--------|------------------------|-------------------------------------------------------------| -| AjuraTech | apikey, secretkey , callerID | Done | - | - | -| Adn | api_key, type, senderid | Done | - | - | -| Banglalink | userID, passwd , sender | Done | - | - | -| BDBulkSMS | token | Done | - | - | -| BoomCast | masking , userName , password | Done | - | - | -| BulksmsBD | api_key,senderid | Done | - | - | -| DianaHost | api_key, type, senderid | Done | - | - | -| DianaSMS | ApiKey, ClientId, SenderId | Done | - | - | -| Esms | api_token, sender_id | Done | - | - | -| ElitBuzz | api_key, type, senderid | Done | not tested yet in live | - | -| Infobip | user, password | Done | not tested yet in live | - | -| MDL | api_key, type, senderid | Done | not tested yet in live | - | -| Metronet | api_key, mask | Done | - | - | -| MimSms | api_key, type, senderid | Done | - | - | -| Mobireach | Username,Password, From | Done | - | - | -| NovocomBD | ApiKey , ClientId , SenderId | Done | - | - | -| OnnoRokomSMS | userName, userPassword, type, maskName, campaignName | Done | not tested yet in live | - | -| RedmoITSms | api_token, sender_id | Done | | - | -| SmartLabSMS | user, password, sender | Done | - | - | -| SmsinBD | api_token, senderid | Done | 01777-333677 | - | -| SMSNet24 | user_id, user_password, route_id(optional), sms_type_id(optional) | Done | - | admin2@digitallabbd.com, +880 1705 691269, +880 1733393 712 | -| SmsNoc | sender_id, bearer_token | Done | - | | -| Sslsms | api_token, sid, csms_id | Done | - | - | -| Tense | user, password, campaign, masking | Done | - | - | -| TwentyFourSmsBD | apiKey, sender_id | Done | - | - | -| Viatech | api_key, mask | Done | - | - | + +| Provider | Credentials Required
For Sending SMS | Status | Comment | Contact | +|-----------------|-------------------------------------------------------------------|----------------|------------------------|-------------------------------------------------------------| +| AjuraTech | apikey, secretkey , callerID | Done | - | - | +| Adn | api_key, type, senderid | Done | - | - | +| Banglalink | userID, passwd , sender | Done | - | - | +| BDBulkSMS | token | Done | - | - | +| BoomCast | masking , userName , password | Done | - | - | +| BulksmsBD | api_key,senderid | Done | - | - | +| DianaHost | api_key, type, senderid | Done | - | - | +| DianaSMS | ApiKey, ClientId, SenderId | Done | - | - | +| Esms | api_token, sender_id | Done | - | - | +| ElitBuzz | api_key, type, senderid | Done | not tested yet in live | - | +| Infobip | user, password | Done | not tested yet in live | - | +| MDL | api_key, type, senderid | Done | not tested yet in live | - | +| Metronet | api_key, mask | Done | - | - | +| MimSms | api_key, type, senderid | Done | - | - | +| Mobireach | Username,Password, From | Done | - | - | +| NovocomBD | ApiKey , ClientId , SenderId | Done | - | - | +| OnnoRokomSMS | userName, userPassword, type, maskName, campaignName | Done | not tested yet in live | - | +| RedmoITSms | api_token, sender_id | Support closed | - | +| SmartLabSMS | user, password, sender | Done | - | - | +| SmsinBD | api_token, senderid | Done | 01777-333677 | - | +| SMSNet24 | user_id, user_password, route_id(optional), sms_type_id(optional) | Done | - | admin2@digitallabbd.com, +880 1705 691269, +880 1733393 712 | +| SmsNoc | sender_id, bearer_token | Done | - | | +| Sslsms | api_token, sid, csms_id | Done | - | - | +| Tense | user, password, campaign, masking | Done | - | - | +| TwentyFourSmsBD | apiKey, sender_id | Done | - | - | +| Trubosms | api_token, sender_id | Done | - | - | +| Viatech | api_key, mask | Done | - | - | + diff --git a/src/Config/sms.php b/src/Config/sms.php index 9983ade..523e1f3 100644 --- a/src/Config/sms.php +++ b/src/Config/sms.php @@ -44,6 +44,7 @@ use Xenon\LaravelBDSms\Provider\SMSNoc; use Xenon\LaravelBDSms\Provider\Ssl; use Xenon\LaravelBDSms\Provider\Tense; +use Xenon\LaravelBDSms\Provider\TruboSms; use Xenon\LaravelBDSms\Provider\TwentyFourSmsBD; use Xenon\LaravelBDSms\Provider\Viatech; @@ -207,6 +208,11 @@ 'campaign' => env('SMS_TENSE_CAMPAIGN', ''), 'masking' => env('SMS_TENSE_MASKING', ''), ], + TruboSms::class => [ + 'sender_id' => env('SMS_TRUBOSMS_SENDER_ID', ''), + 'api_token' => env('SMS_TRUBOSMS_API_TOKEN', ''), + 'type' => env('SMS_TRUBOSMS_TYPE', 'string'), + ], TwentyFourSmsBD::class => [ 'apiKey' => env('SMS_TWENTYFOURSMSBD_APIKEY', ''), 'sender_id' => env('SMS_TWENTYFOURSMSBD_SENDER_ID', ''), diff --git a/src/Provider/TruboSms.php b/src/Provider/TruboSms.php new file mode 100644 index 0000000..4c50e9e --- /dev/null +++ b/src/Provider/TruboSms.php @@ -0,0 +1,81 @@ +senderObject = $sender; + } + + /** + * Send Request To Api and Send Message + * @throws RenderException + */ + public function sendRequest() + { + $number = $this->senderObject->getMobile(); + $text = $this->senderObject->getMessage(); + $config = $this->senderObject->getConfig(); + $queue = $this->senderObject->getQueue(); + + $query = [ + 'recipient' => '+88'.$number, + 'sender_id' => $config['sender_id'], + 'message' => $text, + ]; + + $headers = [ + 'Authorization' => 'Bearer ' . $config['api_token'], + 'Content-Type' => 'application/json' + ]; + + $requestObject = new Request('https://panel.trubosms.com/api/v3/sms/send', $query, $queue); + $requestObject->setHeaders($headers)->setContentTypeJson(true); + $response = $requestObject->post(); + if ($queue) { + return true; + } + + $body = $response->getBody(); + $smsResult = $body->getContents(); + + $data['number'] = $number; + $data['message'] = $text; + return $this->generateReport($smsResult, $data)->getContent(); + } + + /** + * @throws ParameterException + */ + public function errorException() + { + if (!array_key_exists('api_token', $this->senderObject->getConfig())) { + throw new ParameterException('api_token is absent in configuration'); + } + + if (!array_key_exists('sender_id', $this->senderObject->getConfig())) { + throw new ParameterException('sender_id key is absent in configuration'); + } + } + +}