Barta provides a clean, expressive way to send SMS from Laravel applications using Bangladeshi gateways. It gives you a single API for transactional messages, OTP delivery, alerts, queued sends, and notification-based messaging.
The package is designed to feel native in Laravel projects while keeping gateway-specific concerns isolated to drivers and configuration.
- Multiple Gateways — Seamlessly switch between SMS providers
- Bulk SMS — Send to multiple recipients in a single call
- Queue Support — Dispatch SMS to background jobs
- Laravel Notifications — Native integration with Laravel's notification system
- BD Phone Formatting — Automatic phone number normalization to
8801XXXXXXXXXformat - Extensible — Create custom drivers for any SMS gateway
logdriver for local development and testing- Most Bangladeshi SMS gateways are supported
Full gateway list and setup instructions are available at barta.larament.com/gateways.
- PHP 8.2 or higher
- Laravel 11 to 13
Install via Composer:
composer require larament/bartaOptionally, you can run the install command:
php artisan barta:installSet your default driver in .env:
BARTA_DRIVER=logThen send your first message:
use Larament\Barta\Facades\Barta;
Barta::to('01712345678')
->message('Your OTP is 1234')
->send();Send through a specific gateway:
Barta::driver('DRIVER_NAME')
->to('01712345678')
->message('Hello from Larament Barta')
->send();Queue a message for background delivery:
Barta::to('01712345678')
->message('Queued message')
->queue();Send to multiple recipients:
Barta::to(['01712345678', '01812345678'])
->message('Hello everyone!')
->send();Tip
Use the log driver during local development and automated tests to avoid sending real SMS.
Barta integrates with Laravel's notification system through the barta channel:
use Illuminate\Notifications\Notification;
use Larament\Barta\Notifications\BartaMessage;
class OrderShipped extends Notification
{
public function via(object $notifiable): array
{
return ['barta'];
}
public function toBarta(object $notifiable): BartaMessage
{
return new BartaMessage('Your order has been shipped!');
}
}Route notifications to a phone number on your notifiable model:
public function routeNotificationForBarta($notification): string
{
return $this->phone;
}Learn more at barta.larament.com/advanced/notifications.
Barta automatically normalizes Bangladeshi mobile numbers into 8801XXXXXXXXX format.
| Input | Normalized |
|---|---|
01712345678 |
8801712345678 |
+8801712345678 |
8801712345678 |
The full documentation lives at barta.larament.com.
- Getting started: barta.larament.com/usage/basic-usage
- Gateway configuration: barta.larament.com/gateways
- Notifications: barta.larament.com/advanced/notifications
composer test # Run tests
composer test-coverage # With coverage
composer analyse # Static analysisUse the log driver during testing to avoid sending real SMS.
See CHANGELOG.md for recent changes.
See CONTRIBUTING.md for details.
Report vulnerabilities via our security policy.
MIT License. See LICENSE.md.
Made with ❤️ for the Bangladeshi Laravel Community