Laravel package for Robi/AdaReach Business SMS API integration
misfit/robisms is a Laravel package for laravel package for robi/adareach business sms api integration.
It currently has 0 GitHub stars and 379 downloads on Packagist.
Install it with composer require misfit/robisms.
Discover more Laravel packages by misfit
or browse all Laravel packages to compare alternatives.
Last updated
A comprehensive PHP package for integrating with AdaReach (Robi/MobiReach) Business SMS API. Works seamlessly with Laravel or as a standalone PHP library (PHP 7.4+).
Perfect for Laravel applications with full dashboard, analytics, and database integration.
composer require chandan07cse/robi-sms
# Publish config, migrations, and assets
php artisan vendor:publish --provider="AdaReach\Sms\AdaReachServiceProvider"
# Run migrations
php artisan migrate
# Build dashboard assets (optional)
npm install && npm run build
Add these to your .env file:
ADAREARCH_USERNAME=your_username
ADAREARCH_PASSWORD=your_password
ADAREARCH_BASE_URL=https://api.mobireach.com.bd
ADAREARCH_DEFAULT_SENDER=8801XXXXXXXXX
use AdaReach\Sms\Facades\AdaReach;
// Send single SMS
$response = AdaReach::sendSms('01703611094', 'Hello from Laravel!');
// Send bulk SMS
$response = AdaReach::sendBulkSms(
['01703611094', '01812345678'],
'Bulk message'
);
// Check balance
$balance = AdaReach::getBalance();
// Get account info
$info = AdaReach::getAccountInfo();
Visit your Laravel SMS dashboard:
http://your-laravel-app.test/sms-dashboard
Dashboard Features:
Perfect for plain PHP projects, WordPress, custom frameworks, or any PHP 7.4+ application.
composer require chandan07cse/robi-sms
<?php
require_once __DIR__ . '/vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
// Initialize client
$client = new StandaloneClient(
'your_username',
'your_password',
'YourSenderID' // Optional but recommended
);
// Send SMS
try {
$response = $client->sendSms('01703611094', 'Hello from PHP!');
if ($response['status'] === 'SUCCESS') {
echo "β
SMS sent! Message ID: " . $response['id'];
}
} catch (Exception $e) {
echo "β Error: " . $e->getMessage();
}
$phones = ['01703611094', '01812345678', '01956789012'];
$message = 'Hello everyone!';
$response = $client->sendBulkSms($phones, $message);
echo "Sent to " . count($response['successful']) . " numbers";
foreach ($response['failed'] as $failed) {
echo "Failed: {$failed['phone']} - {$failed['error']}\n";
}
// Get current balance
$balance = $client->getBalance();
echo "Current balance: {$balance} BDT\n";
// Get detailed account info
$accountInfo = $client->getAccountInfo();
print_r($accountInfo);
$client = new StandaloneClient(
'username',
'password',
'SenderID',
'https://api.mobireach.com.bd', // Custom base URL
'/path/to/cache' // Custom cache directory
);
// Change sender ID dynamically
$client->setSender('NewSenderID');
// Get current sender
$currentSender = $client->getSender();
Add ONE line to your index.php or routing file:
require __DIR__ . '/vendor/chandan07cse/robi-sms/routes/sms-dashboard.php';
Then visit: http://yoursite.com/sms-dashboard
Alternative Methods:
Using .htaccess (Apache):
RewriteEngine On
RewriteRule ^sms-dashboard$ vendor/chandan07cse/robi-sms/public/sms-dashboard.php [L]
Using Nginx:
location /sms-dashboard {
rewrite ^/sms-dashboard$ /vendor/chandan07cse/robi-sms/public/sms-dashboard.php last;
}
PHP Built-in Server (Development):
cd vendor/chandan07cse/robi-sms/public
php -S localhost:8080 sms-dashboard.php
Environment Configuration:
Create .env file in your project root:
ADAREARCH_USERNAME=your_username
ADAREARCH_PASSWORD=your_password
ADAREARCH_DEFAULT_SENDER=8801XXXXXXXXX
The package automatically normalizes phone numbers. All these formats work:
// All these are normalized to: 8801703611094
$client->sendSms('01703611094', 'Test'); // β
Auto-adds 880
$client->sendSms('1703611094', 'Test'); // β
Auto-adds 880
$client->sendSms('8801703611094', 'Test'); // β
Works as-is
$client->sendSms('+8801703611094', 'Test'); // β
Auto-removes +
+880 β Removes + β 8801703611094880 β No change β 880170361109401 β Replaces with 880 β 88017036110941 β Adds 880 prefix β 8801703611094The package automatically detects Bangla/Unicode characters and sets the correct content type.
// English SMS (contentType=1, 160 chars/SMS)
$client->sendSms('01703611094', 'Hello World');
// Bangla SMS (contentType=2, 70 chars/SMS) - AUTO-DETECTED
$client->sendSms('01703611094', 'ΰ¦Ήΰ§ΰ¦―ালৠবাΰ¦ΰ¦²ΰ¦Ύ!');
// Mixed content (Unicode auto-detected)
$client->sendSms('01703611094', 'Hello ΰ¦Ήΰ§ΰ¦―ালৠ123');
// Emoji (Unicode auto-detected)
$client->sendSms('01703611094', 'Hello π World π');
| Content Type | Characters per SMS | Detection | |--------------|-------------------|-----------| | English/ASCII | 160 characters | Automatic | | Bangla/Unicode | 70 characters | Automatic | | Emoji/Special | 70 characters | Automatic |
// Force Unicode (not recommended, auto-detection is better)
$response = $client->sendSms('01703611094', 'Test', null, true);
public function __construct(
string $username,
string $password,
string $sender = null,
string $baseUrl = 'https://api.mobireach.com.bd',
string $cacheDir = null
)
Send SMS to a single recipient.
public function sendSms(
string $phone,
string $message,
string $sender = null,
bool $isUnicode = null
): array
Parameters:
$phone - Phone number (auto-normalized)$message - SMS content$sender - Sender ID (optional, uses default if not provided)$isUnicode - Force Unicode mode (optional, auto-detected if null)Returns:
[
'status' => 'SUCCESS',
'id' => 'message_id',
'phone' => '8801703611094',
'message' => 'Your message',
'sender' => 'SenderID'
]
Send SMS to multiple recipients.
public function sendBulkSms(
array $phones,
string $message,
string $sender = null,
bool $isUnicode = null
): array
Returns:
[
'status' => 'SUCCESS',
'successful' => ['8801703611094', '8801812345678'],
'failed' => [],
'total' => 2
]
Check account balance.
public function getBalance(): float
Returns: Balance amount (float)
Get detailed account information.
public function getAccountInfo(): array
Returns:
[
'balance' => 1000.50,
'username' => 'your_username',
'api_url' => 'https://api.mobireach.com.bd'
]
Set or change the sender ID.
public function setSender(string $sender): self
Get current sender ID.
public function getSender(): ?string
<?php
require 'vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
$client = new StandaloneClient('username', 'password', 'MySender');
try {
$result = $client->sendSms('01703611094', 'Hello from AdaReach!');
echo "Success! Message ID: " . $result['id'];
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
<?php
require 'vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
$client = new StandaloneClient('username', 'password', 'MySender');
// Read phones from database or CSV
$users = [
['phone' => '01703611094', 'name' => 'John'],
['phone' => '01812345678', 'name' => 'Jane'],
['phone' => '01956789012', 'name' => 'Bob']
];
foreach ($users as $user) {
$message = "Hello {$user['name']}, Welcome to our service!";
try {
$result = $client->sendSms($user['phone'], $message);
echo "β
Sent to {$user['name']}: {$result['id']}\n";
} catch (Exception $e) {
echo "β Failed for {$user['name']}: {$e->getMessage()}\n";
}
// Rate limiting (optional)
sleep(1);
}
<?php
require 'vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
$client = new StandaloneClient('username', 'password', 'MySender');
// Check balance first
$balance = $client->getBalance();
echo "Current balance: {$balance} BDT\n";
if ($balance < 10) {
die("Insufficient balance! Please recharge.\n");
}
// Send SMS
$result = $client->sendSms('01703611094', 'Your OTP is: 123456');
echo "OTP sent! Message ID: " . $result['id'];
<?php
require 'vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
$client = new StandaloneClient('username', 'password', 'MySender');
$phones = ['01703611094', '01812345678'];
$message = 'ΰ¦ΰ¦ͺনার ΰ¦
ΰ¦°ΰ§ΰ¦‘ΰ¦Ύΰ¦° সফল ΰ¦Ήΰ¦―ΰ¦Όΰ§ΰ¦ΰ§ΰ₯€ ধনΰ§ΰ¦―বাদ!';
foreach ($phones as $phone) {
try {
$result = $client->sendSms($phone, $message);
if ($result['status'] === 'SUCCESS') {
echo "β
Sent to {$phone}\n";
} else {
echo "β Failed to {$phone}: " . ($result['error'] ?? 'Unknown error') . "\n";
}
} catch (Exception $e) {
echo "β Exception for {$phone}: {$e->getMessage()}\n";
}
}
<?php
require 'vendor/autoload.php';
use AdaReach\Sms\StandaloneClient;
$client = new StandaloneClient('username', 'password', 'MySender');
// Connect to database
$pdo = new PDO('mysql:host=localhost;dbname=mydb', 'user', 'pass');
// Get pending SMS from database
$stmt = $pdo->query("SELECT id, phone, message FROM pending_sms WHERE sent = 0 LIMIT 100");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
try {
$result = $client->sendSms($row['phone'], $row['message']);
// Update database
$update = $pdo->prepare("UPDATE pending_sms SET sent = 1, message_id = ?, sent_at = NOW() WHERE id = ?");
$update->execute([$result['id'], $row['id']]);
echo "β
Sent SMS ID: {$row['id']}\n";
} catch (Exception $e) {
// Log error
$error = $pdo->prepare("UPDATE pending_sms SET error = ? WHERE id = ?");
$error->execute([$e->getMessage(), $row['id']]);
echo "β Failed SMS ID: {$row['id']}\n";
}
}
Cause: Using old API parameter names.
Solution: Update to latest version:
composer update chandan07cse/robi-sms
Cause: Invalid phone format.
Solution: Use any of these formats (auto-normalized):
'01703611094' // β
Recommended
'8801703611094' // β
Also works
'+8801703611094' // β
Also works
Cause: Old version without Unicode detection.
Solution: Update to latest version. Unicode is now auto-detected:
composer update chandan07cse/robi-sms
Cause: Route not registered or .env not configured.
Solution:
require __DIR__ . '/vendor/chandan07cse/robi-sms/routes/sms-dashboard.php';
.env file with credentialsCause: No write permissions on cache directory.
Solution:
# Create cache directory
mkdir -p storage/cache/sms
# Set permissions
chmod -R 755 storage/cache/sms
Enable debug mode to see detailed API responses:
$client = new StandaloneClient('user', 'pass', 'sender');
try {
$result = $client->sendSms('01703611094', 'Test');
print_r($result); // See full response
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
echo "\nTrace: " . $e->getTraceAsString();
}
Fixed Error 1510 - Standalone client was using incorrect API parameter names.
Fixed:
recipients β receiver (API requirement)text β content (API requirement)msgType = 'T' (Transactional/Promotional flag)requestType = 'S'/'B' (Single/Bulk detection)contentType = 1/2 (Regular text/Unicode flag)Impact:
Added:
This package is open-sourced software licensed under the MIT license.
Made with β€οΈ for the PHP community