Skip to main content

Prerequisites

Before you begin:

  • A SpringEdge account with an API key
  • PHP 7.4 or higher with the cURL extension enabled
  • A DLT-registered sender ID and approved message template (for India)

Zero Dependencies

Uses PHP's built-in cURL — no Composer packages needed

Sub-5ms API Response

Fast REST endpoint with JSON responses

HTTPS + Bearer Auth

Secure API key authentication over TLS

<?php
$apiKey = 'YOUR_API_KEY';
$url    = 'https://api.springedge.com/v1/sms/send';

$payload = json_encode([
    'to'        => '+919876543210',
    'sender_id' => 'SPREDG',
    'message'   => 'Your OTP is 482910',
    'type'      => 'transactional',
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $apiKey,
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "Status: $httpCode\n";
echo "Response: $response\n";

// Response:
// {
//   "status": "success",
//   "message_id": "msg_a1b2c3d4",
//   "credits_used": 1
// }
?>

PHP cURL

Basic PHP Example

This example uses PHP's built-in curl functions to send an SMS through the SpringEdge API. No external packages or Composer dependencies needed — works in any PHP environment.

Quick Start:

  1. Replace YOUR_API_KEY with your SpringEdge API key
  2. Update the phone number, sender ID, and message
  3. Run: php send_sms.php
  4. Check the response for the message ID

LARAVEL

Laravel Service Class

For Laravel applications, create a service class in app/Services/ that wraps the SMS API. Call it from any controller, job, or event listener:

app(SmsService::class)->send('+919876543210', 'Your OTP is 482910');

Store your API key in .env as SPRINGEDGE_API_KEY and access it via config('services.springedge.key').

<?php
// app/Services/SmsService.php
namespace App\Services;

use Illuminate\Support\Facades\Http;

class SmsService
{
    public function send(
        string $phone,
        string $message
    ): array {
        $response = Http::withToken(
            config('services.springedge.key')
        )->post(
            'https://api.springedge.com'
            . '/v1/sms/send',
            [
                'to'        => $phone,
                'sender_id' => 'SPREDG',
                'message'   => $message,
                'type'      => 'transactional',
            ]
        );

        return $response->json();
    }
}
?>

What You Can Build

OTP Verification

Add phone number verification to your PHP/Laravel signup and login flows with one-time passwords.

Order Notifications

Send automated order confirmations, shipping updates, and delivery alerts from your PHP e-commerce backend.

WordPress Plugins

Build custom WordPress plugins that send SMS notifications from WooCommerce, Contact Form 7, or Gravity Forms.

CRM Integration

Connect your PHP-based CRM to send automated SMS alerts triggered by lead capture, deal updates, and task reminders.