PHPackages                             smsfactor/smsfactor-php-sdk - 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. [API Development](/categories/api)
4. /
5. smsfactor/smsfactor-php-sdk

ActiveLibrary[API Development](/categories/api)

smsfactor/smsfactor-php-sdk
===========================

SMSFactor client library for PHP

v1.0.6(1y ago)15382.5k↑12%5[1 issues](https://github.com/smsfactor/smsfactor-php-sdk/issues)[1 PRs](https://github.com/smsfactor/smsfactor-php-sdk/pulls)2MITPHPPHP &gt;=7.2.5CI passing

Since Apr 25Pushed 3mo ago1 watchersCompare

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

READMEChangelog (7)Dependencies (3)Versions (11)Used By (2)

SMSFactor Client library for PHP
================================

[](#smsfactor-client-library-for-php)

The PHP client library makes it easy for developers to use SMSFactor's API.

In order to use it, make sure to have an account. You can register [here](https://www.smsfactor.com/en/registration/?utm_source=github&utm_campaign=Inscription&spid=17146). Once your account is created, you need to generate your first [API token](https://dev.smsfactor.com/en/api/sms/token/create-token). You can find the complete documentation of our API [here](https://dev.smsfactor.com/).

Installation
============

[](#installation)

We recommend using [Composer](https://getcomposer.org/) to install the PHP client library to your project.

```
composer require smsfactor/smsfactor-php-sdk

```

Usage
=====

[](#usage)

Make sure to autoload the library in your bootstrap file :

```
require_once __dir__ . 'vendor/autoload.php';
```

Set your token :

```
\SMSFactor\SMSFactor::setApiToken('your token');
```

Send a message :

```
$response = \SMSFactor\Message::send([
	'to' => '33601000000',
	'text' => 'Did you ever dance whith the devil in the pale moonlight ?'
]);
print_r($response->getJson());
```

Examples
========

[](#examples)

Account
-------

[](#account)

**Get credits**

```
$response = \SMSFactor\Account::credits();
```

**Get account**

```
$response = \SMSFactor\Account::get();
```

**Get subaccounts**

```
$response = \SMSFactor\Account::subAccounts();
```

**Create an account**

```
$response = \SMSFactor\Account::create([
	'account' => [
		"firstname" => "firstname",
		"lastname" => "lastname",
		"city" => "city",
		"phone" => "phone",
		"address1" => "address",
		"zip" => "zip",
		"country_code" => "country code",
		"isChild" => 0, //Is the account a subaccount ?
		"unlimited" => 0, //If isChild, should the subaccount use the parent's credits
		'email' => 'your@email.com',
		'password' => 'password'
	]
]);
```

Campaign
--------

[](#campaign)

**Send a campaign**

```
$delay = date('Y-m-d H:i:s', strtotime('+1 hour')); // now + 1 hour
$response = \SMSFactor\Campaign::send([
    'sms' => [
	    'message' => [
		    'text' => 'test skd php',
		    'pushtype' => 'alert', //alert(default) or marketing
		    'sender' => 'SDK', //Optional
		    'delay' => $delay //Optional. Omit for immediate send
	    ],
	    'recipients' => [
		    'gsm' => [
			    [
				    'value' => '33601000000'
			    ]
		    ]
	    ]
    ]
], false); // True to simulate the campaign (no SMS sent)
```

**Send a campaign to a list**

```
$delay = date('Y-m-d H:i:s', strtotime('+1 hour')); // now + 1 hour
$response = \SMSFactor\Campaign::sendToLists([
    'sms' => [
	    'message' => [
		    'text' => 'test skd php',
		    'pushtype' => 'alert', //alert(default) or marketing
		    'sender' => 'SDK', //Optional
		    'delay' => $delay //Optional. Omit for immediate send
	    ],
	    'lists' => [
		    [
			    'value' => 'your_list_id'
		    ]
	    ]
    ]
], false); // True to simulate the campaign (no SMS sent)
```

**Get information about a campaign**

Use the campaign ticket value returned by our API after sending a campaign to get information about that campaign. Given the last example :

```
$response = \SMSFactor\Campaign::get($response->ticket);
```

**Cancel a delayed campaign**

```
$response = \SMSFactor\Campaign::cancel($response->ticket);
```

**Get campaign history**

```
$response = \SMSFactor\Campaign::history(['length' => 5]); //Get the last 5 campaigns
```

List
----

[](#list)

**Create a list**

You can customize each contact with up to 4 optional information

```
$response = \SMSFactor\ContactList::create([
    'list' => [
	    'name' => 'Your list name',
	    'contacts' => [
		    'gsm' => [
			    [
				    'value' => '33600000001',
				    'info1' => 'Lastname',
				    'info2' => 'Firstname',
				    'info3' => 'Gender'
			    ],
			    [
				    'value' => '33600000002',
				    'info1' => 'Lastname',
				    'info2' => 'Firstname',
				    'info3' => 'Gender'
			    ]
		    ]
	    ]
    ]
]);
$list_id = $response->id
```

**Add contacts to a list**

```
$response = \SMSFactor\ContactList::addContacts([
    'list' => [
	    'list_id' => $list_id
	    'contacts' => [
		    'gsm' => [
			    [
				    'value' => '33600000003',
				    'info1' => 'Lastname',
				    'info2' => 'Firstname',
				    'info3' => 'Gender'
			    ],
			    [
				    'value' => '33600000004',
				    'info1' => 'Lastname',
				    'info2' => 'Firstname',
				    'info3' => 'Gender'
			    ]
		    ]
	    ]
    ]
]);
```

**Get a list**

```
$response = \SMSFactor\ContactList::get($list_id);
```

**Remove a contact from a list**

```
$response = \SMSFactor\ContactList::removeContact($contact_id); //use Get list to get contact id
```

**Deduplicate a list**

```
$response = \SMSFactor\ContactList::deduplicate($list_id);
```

**Get all lists**

```
$response = \SMSFactor\ContactList::all();
```

**Remove a list**

```
$response = \SMSFactor\ContactList::delete($list_id);
```

**Add contacts to the blacklist**

```
 $response = \SMSFactor\ContactList::addToBlacklist([
	'blacklist' => [
		'contacts' => [
			'gsm' => [
				[
					'value' => '33600000003'
				],
				[
					'value' => '33600000004'
				]
			]
		]
	]
]);
```

**Get blacklist**

```
$response = \SMSFactor\ContactList::blacklist();
```

**Add contacts to the NPAI list**

```
$response = \SMSFactor\ContactList::addToNpai([
	'npai' => [
		'contacts' => [
			'gsm' => [
				[
					'value' => '33600000003'
				],
				[
					'value' => '33600000004'
				]
			]
		]
	]
]);
```

**Get NPAI list**

```
$response = \SMSFactor\ContactList::npai();
```

Token
-----

[](#token)

**Create a token**

```
$response = \SMSFactor\Token::create([
    'token' => [
	    'name' => 'token sdk'
    ]
]);
$token = $response->token;
$token_id = $response->token_id;
```

**Get your tokens**

```
$response = \SMSFactor\Token::all();
```

**Delete a token**

```
$response = \SMSFactor\Token::delete($token_id);
```

Webhook
-------

[](#webhook)

To see all available webhooks, please go to our [official documentation](https://dev.smsfactor.com).

**Create a webhook**

```
$response = \SMSFactor\Webhook::create([
	'webhook' => [
		'type' => 'DLR',
		'url' => 'https://yourserverurl.com'
	]
]);
$webhook_id = $response->webhook->webhook_id;
```

**Get your webhooks**

```
$response = \SMSFactor\Webhook::all();
```

**Update a webhook**

```
$response = \SMSFactor\Webhook::update($webhook_id, [
    'webhook' => [
	    'type' => 'MO',
	    'url' => 'https://yourserverurl.net'
    ]
]);
```

**Delete a webhook**

```
$response = \SMSFactor\Webhook::delete($webhook_id);
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance64

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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 ~366 days

Recently: every ~389 days

Total

7

Last Release

381d ago

PHP version history (2 changes)v1.0PHP &gt;=5.3.0

v1.0.3PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/59b01e35d9a2e4224c89961d099e6444b460d181f715edc30e16caa35140b6e7?d=identicon)[SMSFactor](/maintainers/SMSFactor)

---

Top Contributors

[![fpalamour](https://avatars.githubusercontent.com/u/10830197?v=4)](https://github.com/fpalamour "fpalamour (26 commits)")[![MisterDuval](https://avatars.githubusercontent.com/u/66914?v=4)](https://github.com/MisterDuval "MisterDuval (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![ogizanagi](https://avatars.githubusercontent.com/u/2211145?v=4)](https://github.com/ogizanagi "ogizanagi (1 commits)")

---

Tags

apisms

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/smsfactor-smsfactor-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/smsfactor-smsfactor-php-sdk/health.svg)](https://phpackages.com/packages/smsfactor-smsfactor-php-sdk)
```

###  Alternatives

[africastalking/africastalking

Official Africa's Talking PHP SDK

122557.6k10](/packages/africastalking-africastalking)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[unicodeveloper/jusibe-php-lib

Jusibe PHP Library

3417.4k1](/packages/unicodeveloper-jusibe-php-lib)[minchao/mitake-php

A Mitake SMS SDK for PHP (Unofficial)

347.8k1](/packages/minchao-mitake-php)

PHPackages © 2026

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