ReSMS Logo
Skip to Content

PHP

Welcome to the ReSMS PHP integration guide.

This guide explains how you can quickly send SMS messages using the ReSMS API in your PHP applications.

Installation

Install our PHP SDK using Composer:

composer require resms/sdk

Or manually add it to your composer.json:

{ "require": { "resms/sdk": "^1.0" } }

Quickstart

Here’s a simple example to send an SMS:

<?php require 'vendor/autoload.php'; use ReSMS\ReSMSClient; $client = new ReSMSClient([ 'apiKey' => getenv('RESMS_API_KEY'), ]); $response = $client->sendSMS([ 'to' => '+1234567890', 'message' => 'Welcome to ReSMS!', ]); print_r($response);

Authentication

Your API Key must be kept secure. Set it in your server environment:

export RESMS_API_KEY=your-api-key-here

Features

  • Send transactional and promotional SMS
  • Reliable message delivery worldwide
  • Real-time delivery status tracking

Error Handling

Always wrap your API calls in try-catch blocks:

<?php try { $response = $client->sendSMS([ 'to' => '+1234567890', 'message' => 'Welcome!', ]); } catch (Exception $e) { echo 'Failed to send SMS: ', $e->getMessage(); }

Going Further


Need help? Contact support@resms.io

Last updated on