PHPackages                             spryng/rest-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. spryng/rest-api-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

spryng/rest-api-php
===================

Implementation of the REST API in PHP

v1.1.0(5y ago)3278.5k↑15.8%8[4 issues](https://github.com/Spryng/rest-api-php/issues)[7 PRs](https://github.com/Spryng/rest-api-php/pulls)1BSD-2-ClausePHPCI failing

Since Jun 1Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Spryng/rest-api-php)[ Packagist](https://packagist.org/packages/spryng/rest-api-php)[ RSS](/packages/spryng-rest-api-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (1)

Spryng SMS REST Library for PHP
-------------------------------

[](#spryng-sms-rest-library-for-php)

This repository contains the source code for the Spryng SMS REST API library for PHP. This library will make it very easy to integrate the SMS gateway into your application. It offers all the functionality that the API has to offer.

### Installation

[](#installation)

Installation is easily done using composer:

```
composer require spryng/rest-api-php
```

When the installation is complete, you can initialize the library with your API key:

```
require_once "vendor/autoload.php";

use Spryng\SpryngRestApi\Spryng;

$spryng = new Spryng($apiKey);
```

### Sending messages

[](#sending-messages)

To send a message, supply the `send` method with the information about the message you'd like to send:

```
use Spryng\SpryngRestApi\Objects\Message;
use Spryng\SpryngRestApi\Spryng;

$spryng = new Spryng($apiKey);

$message = new Message();
$message->setBody('My message');
$message->setRecipients(['31612344567', '31698765432']);
$message->setOriginator('My Company');

$response = $spryng->message->send($message);

if ($response->wasSuccessful())
{
	$message = $response->toObject();
	echo "Message with ID " . $message->getId() . " was send successfully!\n";
}
else if ($response->serverError())
{
	echo "Message could not be send because of a server error...\n";
}
else
{
	echo "Message could not be send. Response code: " . $response->getResponseCode() ."\n";
}
```

### Getting info about a message

[](#getting-info-about-a-message)

Single messages can be queried by their ID:

```
use Spryng\SpryngRestApi\Objects\Message;
use Spryng\SpryngRestApi\Spryng;

$spryng = new Spryng($apiKey);

$response = $spryng->message->getMessage("9dbc5ffb-7524-4fae-9514-51decd94a44f");

if ($resposne->wasSuccessful())
{
	echo "The body of the message is: " . $response->toObject()->getBody() . "\n";
}
```

### Listing messages

[](#listing-messages)

You can list the messages you have send in a paginated manner. You can also apply filters to get a sub-set of the messages you have send:

```
use Spryng\SpryngRestApi\Objects\Message;
use Spryng\SpryngRestApi\Spryng;

$spryng = new Spryng($apiKey);

$response = $spryng->message->showAll(
	1, // page
	20, // limit: items per page
	[ // An array of filters
		'recipient_number' => '31612345667'
	]
);

if ($response->wasSuccessful())
{
	// Will return an instance of MessageCollection
	$messages = $response->toObject();
	echo "Found " . $messages->getTotal() . " results:\n";

	foreach ($messages->getData() as $message)
	{
		echo sprintf("ID: %s ('%s') send on: %s\n",
			$message->getId(),
			$message->getBody(),
			$message->getCreatedAt()
		);
	}
}
```

### Getting your balance

[](#getting-your-balance)

You can also check the remaining credit balance on your account:

```
use Spryng\SpryngRestApi\Objects\Message;
use Spryng\SpryngRestApi\Spryng;

$spryng = new Spryng($apiKey);

$balance = $spryng->balance->get()->toObject();
echo "You have " . $balance->getAmount() . " credits remaining\n";
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 93.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~178 days

Total

3

Last Release

2186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/89756ee91cf468cc56bbc71ec8351fd2ab46ee09c2ef99097cde71944b741ce9?d=identicon)[spryng](/maintainers/spryng)

---

Top Contributors

[![Roemerb](https://avatars.githubusercontent.com/u/4710404?v=4)](https://github.com/Roemerb "Roemerb (14 commits)")[![paulvancraen](https://avatars.githubusercontent.com/u/13237134?v=4)](https://github.com/paulvancraen "paulvancraen (1 commits)")

---

Tags

phpapirestsmstextgatewayspryng

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spryng-rest-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/spryng-rest-api-php/health.svg)](https://phpackages.com/packages/spryng-rest-api-php)
```

###  Alternatives

[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[nadar/aspsms

Simple to use sms sending class for the aspsms.com gateway.

1049.2k2](/packages/nadar-aspsms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
