adedaramola/laravel-sendchamp

A Laravel package to work with sendchamp API

v0.0.1 2022-08-29 14:42 UTC

This package is auto-updated.

Last update: 2024-04-29 04:47:54 UTC


README

Laravel package to seamlessly integrate Sendchamp API

Table of contents

Installation

You can install the package via composer:

composer require adedaramola/laravel-sendchamp

Publish the config file

php artisan vendor:publish --config=

Be sure to set the following variables in your .env file

SENDCHAMP_PUBLIC_KEY=

Basic Usage

The package automaticaly assumes a test mode enviroment for the API, you can change this by setting SENDCHAMP_MODE=true in your .env file.

SMS

use Adedaramola\Sendchamp\Facades\Sendchamp;
use Adedaramola\Sendchamp\Http\Requests\SendSmsRequest;
use Adedaramola\Sendchamp\Http\Requests\CreateSenderIdRequest;

// Send an sms
Sendchamp::sms()->send(new SendSmsRequest(
    $to,
    $message,
    $sender_name,
    $route
));

// Create a new sender ID
Sendchamp::sms()->createSenderID(new CreateSenderIdRequest(
    $name,
    $sample,
    $use_case
));

// Get sms delivery report
Sendchamp::sms()->getDeliveryReport($sms_uid);

// Get bulk sms delivery report
Sendchamp::sms()->getBulkDeliveryReport($bulksms_uid);

Voice

use Adedaramola\Sendchamp\Facades\Sendchamp;
use Adedaramola\Sendchamp\Http\Requests\TextToSpeechRequest;
use Adedaramola\Sendchamp\Http\Requests\FileToVoiceRequest;

// text-to-speech
Sendchamp::voice()->textToSpeech(new TextToSpeechRequest(
    $customer_mobile_number,
    $message,
    $type,
    $repeat
));

// file-to-voice
Sendchamp::voice()->fileToVoice(new FileToVoiceRequest(
    $customer_mobile_number,
    $path,
    $type,
    $repeat
));

// Get delivery report
Sendchamp::voice()->getDeliveryReport();

Verification

use Adedaramola\Sendchamp\Facades\Sendchamp;
use Adedaramola\Sendchamp\Http\Requests\SendOtpRequest;

// send otp
Sendchamp::verification()->sendOtp(new SendOtpRequest(
    $channel,
    $sender,
    $token_type,
    $token_length
));

// verify otp
Sendchamp::verification()->confirmOtp(
    $verification_reference, $verification_code
);

Whatsapp

use Adedaramola\Sendchamp\Facades\Sendchamp;

Sendchamp::whatsapp()->sendText();
Sendchamp::whatsapp()->sendVideo();
Sendchamp::whatsapp()->sendAudio();
Sendchamp::whatsapp()->sendSticker();

Wallet

use Adedaramola\Sendchamp\Facades\Sendchamp;

// get your sendchamp wallet balance
Sendchamp::wallet()->getBalance();

Todo List

  • Email Resource
  • Customer Resource

Contributing

PRs are greatly appreciated, help us build this hugely needed tool so anyone else can easily integrate sendchamp into their Laravel based projects and applications.

  1. Create a fork
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 🚀

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

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