PHPackages                             smsleopard/smsleopard - 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. smsleopard/smsleopard

ActiveLibrary[API Development](/categories/api)

smsleopard/smsleopard
=====================

SMS api client for SMSLeopard.

1.0.0(6y ago)1431[2 issues](https://github.com/FocusMobileLtd/smsleopard-php/issues)[5 PRs](https://github.com/FocusMobileLtd/smsleopard-php/pulls)PHP

Since Jun 24Pushed 3y agoCompare

[ Source](https://github.com/FocusMobileLtd/smsleopard-php)[ Packagist](https://packagist.org/packages/smsleopard/smsleopard)[ RSS](/packages/smsleopard-smsleopard/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (10)Used By (0)

Smsl-php-lib
============

[](#smsl-php-lib)

This is the SMS Leopard API client for PHP. Its meant to help simplify intergration on php based applications.

Getting started
---------------

[](#getting-started)

To use the api you need an account with SMSLeopard, its free to make one. Just head over to the [SMSLeopard homepage](https://www.smsleopard.com/).

API Keys
--------

[](#api-keys)

To generate the api keys, you will need to upgrade to an Enterprise account. This is also a free upgrade, we just need you to send an email request to .

After that, just log in to your dashboard and click the settings link, then the api keys link.

Once at the api keys page, click add new key. Enter the key name and follow the instructions to get and save you api keys.

Installing
----------

[](#installing)

The api client is hosted on packagist. You will need to install composer in your project to install it. Once you have installed composer you can use composer require to download the api client.

```
composer require smsleopard/smsleopard
```

Send a message
--------------

[](#send-a-message)

### Send a normal message

[](#send-a-normal-message)

To send a normal message

```
$account_id = 'YOUR ACCOUNT ID';
$account_key   = 'YOUR ACCOUNT KEY';
$client      = new Client($account_id, $account_key);

$message = 'Test message';
$sender_id = 'SMS_TEST';
$recipients = [
  ['number'=> '+2547960000001'],
  ['number'=> '+2547960000002']
];

$response   = $client->send($sender_id, $message, $recipients);
$res_recipients = $response['recipients'];
$res_status = $response['status'];

print_r($response);
print_r($res_recipients);
print_r($res_status);
```

### Send a custom message

[](#send-a-custom-message)

To send a custom message

```
$account_id = 'YOUR ACCOUNT ID';
$account_key   = 'YOUR ACCOUNT KEY';
$client      = new Client($account_id, $account_key);

$message = 'Test message {name}';
$sender_id = 'SMS_TEST';
$recipients = [
  ['number'=> '+2547960000001', 'message'=> 'Test message Brian'],
  ['number'=> '+2547960000002', 'message'=> 'Test message Emma']
];

$response   = $client->send($sender_id, $message, $recipients, true);
$res_recipients = $response['recipients'];
$res_status = $response['status'];

print_r($response);
print_r($res_recipients);
print_r($res_status);
```

Example
-------

[](#example)

After installing the package, you can copy paste this example to a php file to test out your credentials and the api functions.

```
