A Laravel package for seamless integration with Jasmin SMS Gateway, supporting HTTP, REST API, and SMPP connections.
- Easy-to-use interface for sending and receiving SMS
- Support for HTTP and REST API jasmin options
- SMPP support is coming soon
- Delivery report handling
You can install the package via composer:
composer require ringlesoft/jasmin-clientphp artisan vendor:publish --provider="RingleSoft\JasminClient\JasminClientServiceProvider"Then, edit the config/jasmin_client.php file with your Jasmin SMS Gateway credentials and preferred settings.
The following are available configurations. Most of these are just defaults and can be overridden in your code
url: The base url of the jasmin server (include the port if different from80or443/446)username: The username for your jasmin accountpassword: The password for your jasmin accountdlr_callback_url: The default sms delivery callback urlbatch_callback_url: the default batch callback urlbatch_errback_url: the default batch errback urldefault_dlr_method: the default dlr method (GET/POST)default_dlr_level: The default DLR level (1, 2, or 3)batch_chunk_size: The default Chunk size for batches
$sms = JasminClient::message()
->content('Hello there! Have a nice day')
->to("255711000000")
->from('INFO')
->via('rest') // 'rest' or 'http'
->send();- Returns
RingleSoft\JasminClient\Models\Jasmin\SentMessage
$message = JasminClient::message(to: "255711000000", content: "Hello There. Have a nice day");
$message2 = JasminClient::message(to: "255711000002", content: "Hello There. Have a nice day");
$batch = JasminClient::batch()
->addMessage($message)
->addMessage($message2)
->from("INFO")
->send();- Returns
RingleSoft\JasminClient\Models\Jasmin\SentBatch
This package provides a streamlined way to handle delivery statuses.
Class DlrController extends Controller
{
public function handleDlr(Request $request)
{
return JasminClient::receiveDlrCallback($request, function(DeliveryCallback $dlr) {
// do something with the dlr and return true for success or false for failure
// For example, you can dispatch a job to process the Delivery Report
return true;
});
}
}When messages are sent in a batch, Jasmin responds with the ID of the batch created (batchId) and enqueue the messages.
When each message is sent to SMC, jasmin fires a callback (batch callback) with messageId of each message within the
batch.
To handle batch callbacks, you can use the receiveBatchCallback method.
Class DlrController extends Controller
{
public function handleDlr(Request $request)
{
return JasminClient::receiveDlrCallback($request, function(DeliveryCallback $dlr) {
// do something with the dlr and return true for success or false for failure
// For example, you can dispatch a job to process Batch Callback
return true;
});
}
} $route = JasminClient::rest()->checkRoute("255711000000"); $balance = JasminClient::rest()->checkBalance(); $metrics = JasminClient::http()->getMetrics();I'll soon let you know when you can contribute to this project.
This package is open-sourced software licensed under the MIT license.
Follow me on X: @ringunger
Email me: ringunger@gmail.com
Website: https://ringlesoft.com
Note: This package is still under development. Please report any issues you encounter.