larament/barta

Barta is a Laravel package designed to integrate popular Bangladeshi SMS gateways seamlessly.
1,466 60
Install
composer require larament/barta
Latest Version:v1.5.1
PHP:^8.2
License:MIT
Last Updated:Sep 18, 2026
Links: GitHub  ·  Packagist
Maintainer: Raziul

Barta is a Laravel package for integrating Bangladeshi SMS gateways.

Barta - Laravel package for integrating Bangladeshi SMS gateways

Latest Version on Packagist Total Downloads Run Tests PHPStan Laravel Compatibility License

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.

Key Features

  • Multiple Gateways — Seamlessly switch between SMS providers
  • Check Balance — Query account credit across providers for dashboards and alerts
  • 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 8801XXXXXXXXX format
  • Extensible — Create custom drivers for any SMS gateway

Supported Gateways

  • log driver for local development and testing
  • Most Bangladeshi SMS gateways are supported

Full gateway list and setup instructions are available at barta.larament.com/gateways.

Requirements

  • PHP 8.2 or higher
  • Laravel 11 to 13

Installation

Install via Composer:

composer require larament/barta

Optionally, you can run the install command:

php artisan barta:install

Quick Start

Set your default driver in .env:

BARTA_DRIVER=log

Then 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();

Check account balance:

// Check balance on default driver
$balance = Barta::balance(); // 150.00 (float)

// Check balance on a specific gateway
$balance = Barta::driver('mimsms')->balance();

// Example: Alert when balance is low
if (Barta::balance() < 50.0) {
    // Notify admin to recharge
}

[!TIP] Use the log driver during local development and automated tests to avoid sending real SMS.

Laravel Notifications

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.

Phone Number Formatting

Barta automatically normalizes Bangladeshi mobile numbers into 8801XXXXXXXXX format.

Input Normalized
01712345678 8801712345678
+8801712345678 8801712345678

Documentation

The full documentation lives at barta.larament.com.

Testing

composer test          # Run tests
composer test:coverage # With coverage
composer analyse       # Static analysis

Use the log driver during testing to avoid sending real SMS.

Changelog

See CHANGELOG.md for recent changes.

Contributing

See CONTRIBUTING.md for details.

Security

Report vulnerabilities via our security policy.

Credits

License

MIT License. See LICENSE.md.


Related Packages

okyayaykut/sms

iletiMerkezi, SMS API'si aracılığı ile kendi yazılımlarınız la SMS gönderme özel...

166 3
andrewboy/laravel-see-me

Laravel package for SeeMe SMS sender.

554 0
rinvex/laravel-authy

Rinvex Authy is a simple wrapper for Authy TOTP, the best rated Two-Factor Authe...

78,280 32
laravel-notification-channels/authy

Authy notification channel for Laravel, with the ability to send in-app, sms, an...

46,708 57
toplan/laravel-sms

A mobile phone number validation solution based on laravel

80,792 836