PHP code example of rahulhaque / adn-sms

1. Go to this page and download the library: Download rahulhaque/adn-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/ */

    

rahulhaque / adn-sms example snippets


$app->register(RahulHaque\AdnSms\AdnSmsServiceProvider::class);

$app->configure('adn-sms');
bash
php artisan vendor:publish --provider="RahulHaque\AdnSms\AdnSmsServiceProvider"
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::to('01XXXXXXXXX')
            ->message('Send SMS Test.')
            ->send();
        
        return $response->json();
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::otp('01XXXXXXXXX')
            ->message('Send OTP SMS Test.')
            ->send();

        return $response->json();
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::bulk(['01XXXXXXXXX', '02XXXXXXXXX'])
            ->campaignTitle('Bulk SMS Test')
            ->message('Send Bulk SMS Test.')
            ->send();
        
        return $response->json();
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;
use Illuminate\Http\Client\Response;
use App\Models\Table;

class SomeController
{
    public function someFunction()
    {
        AdnSms::bulk(['01XXXXXXXXX', '02XXXXXXXXX'])
            ->campaignTitle('Bulk SMS Test')
            ->message('Send Bulk SMS Test.')
            ->queue(function (Response $response) {
                // Check if the response body is empty
                if ($response->body() != "") {
                    // Store the $response in the database
                    $model = new Table();
                    $model->data = $response->body();
                    $model->save();
                }
            });
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::checkBalance();
        
        return $response->json();
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::checkSmsStatus('SXXXXXXXXXXXXXXXX');
        
        return $response->json();
    }
}
 php
use RahulHaque\AdnSms\Facades\AdnSms;

class SomeController
{
    /**
     * Make request and return response
     *
     * @return \Illuminate\Http\Client\Response
     * @throws \Throwable
     */
    public function someFunction()
    {
        $response = AdnSms::checkCampaignStatus('CXXXXXXXXXXXXXXXX');
        
        return $response->json();
    }
}