kudinovfedor/sms-club-json

v1.0.1 2021-11-11 19:38 UTC

This package is auto-updated.

Last update: 2024-09-17 19:13:48 UTC


README

Installation

Require this package with composer using the following command:

composer require kudinovfedor/sms-club-json

Usage

$manager = new \KudinovFedor\SmsClubJSON\SmsManager([
    'token' => 'token', // Token of the user account (which can be obtained in your account in the "Profile" section)
    'from'  => 'from' // Alpha name from which to send
]);

// or
$manager = new \KudinovFedor\SmsClubJSON\SmsManager();
$manager->setToken('token');
$manager->setFrom('from');

Sending messages

After successful sending of the message to the partner’s system, an array will be returned, info in which the key is the id message in our system, by which you can receive the status and the phone number to which the message was sent. In the example below, 106 requests for the given id sms, 380989361131 - recipient's number. An array of add_info may also be present, where information on unsent messages is displayed in the form:

Key - recipient's number Value - Text error

$manager->setTo(['380989361131', '380989361130'])
$manager->setMessage('Your message');
$response = $manager->send();

return

[
    "info": [
        "107": "380989361131"
    ],
    "add_info": [
        "380989361130": "Данный номер находится в черном списке"
    ]
]

Getting the status of messages

Will return the array info in which the key will be id messages and the value of his stat

$status = $manager->getStatus(['106', '107']);
// or
$manager->setSmsIds(['106', '107']);
$status = $manager->getStatus();

return

[
    "106": "ENROUTE",
    "107": "REJECTD"
]

Getting user balance

$balance = $manager->getBalance();

return

[
    "money": "8111.1700",
    "currency": "UAH"
]

Getting a list of alpha usernames

$originator = $manager->getOriginator();

return

[
    [0] => "test1",
    [1] => "test2"
]

Check on errors

if ($manager->hasErrors()) {
    $response = $manager->getErrors();
}

License

The SMS Club API is open-sourced software licensed under the MIT license