Key Takeaways
- Setting up a Laravel SMS gateway here means: pair an Android, put the Bearer key in env, enqueue Http jobs, canary a staff number.
- There is no official Composer “Complete Laravel SDK.” Language samples are REST HTTPS/JSON.
- Do not await GSM inside a controller. Use the queue so radio latency is a worker problem.
- Live field names belong in Developer Center, not in a gist you copied in 2023.
- You need a working Android phone with a SIM and SMS credit from your mobile operator. Operator message costs are yours—we do not sell carrier SMS balance.
Search how to set up laravel sms gateway should mean a working send path, not a marketplace package. Hub for the HTTP contract: Laravel Android SMS gateway API. API overview: Android SMS gateway API. Live names: Developer Center.
You need a working Android phone with a SIM and SMS credit from your mobile operator. Operator message costs are yours—we do not sell carrier SMS balance. Devices and send volume.
.env → queue worker → POST /messages → paired SIM. That is setup.
What “set up Laravel” actually means
Laravel already has HTTP, queues, and env. The gateway is not another framework. Pair the phone, then teach a job to speak JSON. Device setup · downloads.
If artisan serve can send SMS only while your laptop lid is open, you did not set up a gateway. You set up a demo.
How to set up the path
- Pair a dedicated Android. Native SMS must work before any PHP.
- Add
SMS_GATEWAY_API_KEYto.env. Config cache after. - Create a job that POSTs to
https://app.sms-gateway.app/api/v1/messages. - Dispatch from a listener or controller — do not await the radio.
- Canary a staff MSISDN. Confirm DLR.
Queue docs (framework, not us): laravel.com/docs/queues.
Env, not a Composer SMS SDK
Wrapping Http in a tiny client class is fine. Publishing it as “the official Laravel SDK” is not. Keys never belong in the repo or Vite bundle. API keys in env.
Queue before the radio
Redis/database queue + --timeout beats a 60-second FPM hang when the phone is in a lift. On Free and Developer, sending pauses when you use the plan SMS allowance rather than silently billing aggregator-style overage. Upgrade or request a custom allowance to continue.
Setup checklist
| Step | Done when | Not done when |
|---|---|---|
| Pairing | App shows paired after reboot | Only while you hold the phone |
| Env | Key in production secret store | Key in a Slack screenshot |
| Job | Worker running, timeout set | Sync send in the controller |
| Idempotency | Business id on the header | Random uuid every retry |
| Canary | Staff DLR delivered | HTTP 200 only |
HTTPS JSON sample
PHP stream sample (same contract Laravel Http would call):
<?php
// SMS Gateway — POST /api/v1/messages (Bearer JSON). Docs: https://docs.sms-gateway.app/
$url = 'https://app.sms-gateway.app/api/v1/messages';
$key = getenv('SMS_GATEWAY_API_KEY'); // never commit real keys
$payload = json_encode([
'to' => ['+14155552671'], // E.164 with +
'text' => 'Hello from SMS Gateway!',
'type' => 'sms',
]);
$ctx = stream_context_create([
'http' => [
'method' => 'POST',
'header' => implode("\r\n", [
'Authorization: Bearer ' . $key,
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
]),
'content' => $payload,
'timeout' => 30,
'ignore_errors' => true,
],
]);
$response = file_get_contents($url, false, $ctx);
$result = json_decode($response, true);
if (!empty($result['messages'][0]['id'])) {
$id = $result['messages'][0]['id'];
echo 'Queued. Message ID: ' . $id;
} else {
$err = $result['error']['code'] ?? 'unknown';
echo 'Error: ' . $err . ' — ' . ($result['error']['message'] ?? $response);
}
Isolate OTP: OTP. Depth on the API surface: in-depth API guide.
Next steps
Pair, enqueue, canary — then add webhooks. Delivery reports. Spend 300 lifetime SMS proving setup, not load-testing the SIM.
Related product pages
Jump to the live product docs for this topic—not another long-form article.
- SMS API documentationLive endpoint reference
- PHP REST send samplesPHP code examples
- device and SMS volume pricingPlans and allowances
- Android SMS gateway product guideDefinition, product, and how to buy





