moeen-basra / send-pk
Send SMS via SendPk
v1.1.0
2022-09-01 17:11 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7
README
The package for laravel to send sms messages using the send pk
Prerequisites
- php >= 8.1
- guzzlehttp/guzzle >= 7
Installation
composer require moeen-basra/send-pk
Publish config
php artisan vendor:publish --tag send-pk-config
Publish lang if you want localization
php artisan vendor:publish --tag send-pk-lang
How to use
Before moving forward make sure you update the config/send-pk.php
file.
Using the SmsMessage
<?php use MoeenBasra\SendPk\SmsMessage class MyClass { public function sendMessage(): void { $response = (new SmsMessage()) ->fields('template_id', confg('send-pk.templates.{my_template_id}')) ->fields('message', [ // template parameters ]); if ($response->code === 200) { // handle success } else { // handle failed } } }
Using the container
<?php class MyClass { public function sendMessage(): void { $response = app('send-pk') ->send($phone_number, [ 'template_id' => confg('send-pk.templates.{my_template_id}'), 'message' => [ // template parameters ] ]); if ($response->code === 200) { // handle success } else { // handle failed } } }
Contact
Reach me at email here