PHP code example of camoo / sms

1. Go to this page and download the library: Download camoo/sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

camoo / sms example snippets


	$oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
	$oMessage->from ='YourCompany';
	$oMessage->to = '+237612345678';
	$oMessage->message ='Hello Kmer World! Déjà vu!';
	var_dump($oMessage->send());
  

	$oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
	$oMessage->from ='YourCompany';
	$oMessage->to =['+237612345678', '+237612345679', '+237612345610', '+33689764530'];
	//OR from version 3.3.0
	$collection = new RecipientCollection();
        $collection->add('237612345678');
        $collection->add('237612345679');
        $collection->add('237612345610');
        $collection->add('33689764530');
        $oMessage->to = $collection;
        
	$oMessage->message ='Hello Kmer World! Déjà vu!';
	var_dump($oMessage->send());

    $oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
    $oMessage->from ='WhatEver'; // will be overridden
    $oMessage->to = '+237612345678';
    // This parameter tells our system to use the classic route to send your message.
    $oMessage->route ='classic';
    $oMessage->message ='Hello Kmer World! Déjà vu!';
    var_dump($oMessage->send());

	$oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
	$oMessage->from ='YourCompany';
	$oMessage->to = '+237612345678';
	$oMessage->message ='Hello Kmer World! Déjà vu!';
	$oMessage->encrypt = true;
	var_dump($oMessage->send());
  

	$oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
	$oMessage->from ='YourCompany';
	$oMessage->to = ['+237612345678', '+237612345679', '+237612345610', '+33689764530', '+4917612345671'];
	$oMessage->message ='Hello Kmer World! Déjà vu!';
	var_dump($oMessage->sendBulk());
  

	$oMessage = \Camoo\Sms\Message::create('YOUR_API_KEY', 'YOUR_API_SECRET');
	$oMessage->from ='YourCompany';
	$oMessage->to = [['name' => 'John Doe', 'mobile' => '+237612345678'], ['name' => 'Jeanne Doe', 'mobile' => '+237612345679'], ['...']];
	$oMessage->message ='Hello %NAME% Kmer World! Déjà vu!';
	var_dump($oMessage->sendBulk());
  

// Step 1: create Top up instance
/** @var TopUp&\Camoo\Sms\Objects\TopUp $topup */
$topup = TopUp::create('YOUR_API_KEY', 'YOUR_API_SECRET');

// Step 2 Assign phone number and amount
$topup->amount = 3000;
$topup->phonenumber = '612345678';

// Step 3 Call add to top up your account. You will then receive a notification to complete the process.
$response = $topup->add();

var_dump($response);