undjike/cleansms

Send SMS and manage your CleanSMS account.

v1.0.0 2020-08-30 20:40 UTC

This package is auto-updated.

Last update: 2024-10-29 05:53:48 UTC


README

logo

Latest Stable Version License Total Downloads Dependents

Introduction

This PHP package enables you to easily send SMS using CleanSMS Service. It has an elegant syntax, and it is very easy to install and use.

Just few steps, and it's ready.

Create an account on CleanSMS, configure it and generate API Key. Then, let's start.

Installation

This package can be installed via composer. Just type :

composer require undjike/cleansms

This will download everything needed for the package to work in your project.

Usage

After installation, you can send SMS.

use Undjike\CleanSmsPhp\CleanSms;

CleanSms::create()
     ->apiKey('SMS_API_KEY')
     ->email('YOUR_CLEANSMS_EMAIL')
     ->sendSms(
         'MESSAGE_TO_SEND',
         'RECEIVER_PHONE_NUMBER Phone number (Ex: "+237*****") or array of phone numbers (Ex: ["+237*****", "+245*****", ...])'
     );

/**
    Return true if the message is successfully sent, false if not.
    The response can be a JSON in some cases like 'no balance'.
*/

Note: RECEIVER_PHONE_NUMBER can be an array of valid phone numbers, or a string containing a single number.

You can query your account balance using this package.

use Undjike\CleanSmsPhp\CleanSms;

CleanSms::create()
     ->apiKey('SMS_API_KEY')
     ->email('YOUR_CLEANSMS_EMAIL')
     ->getCredit();

/**
    Return the number of SMS remaining in your account. (Ex: 44)
*/

License

The MIT License (MIT). Please see License File for more information.