Skip to content

Basic Usage

Send SMS messages using Barta’s clean, expressive API.

use Larament\Barta\Facades\Barta;
Barta::to('01712345678')
->message('Your OTP is 1234')
->send();
MethodDescription
to(string|array $numbers)Set recipient(s)
message(string $message)Set SMS content
send()Send immediately
queue()Queue for background processing
driver(string $driver)Use specific gateway
Barta::driver('esms')
->to('01712345678')
->message('Hello from eSMS!')
->send();
$response = Barta::to('01712345678')
->message('Hello!')
->send();
if ($response->success) {
echo 'Message sent!';
$data = $response->data; // Raw API response
}
$array = $response->toArray();
// ['success' => true, 'data' => [...], 'errors' => []]