PHP code example of bahricanli / corvass-php

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

    

bahricanli / corvass-php example snippets




use BahriCanli\Corvass\CorvassService;
use BahriCanli\Corvass\CorvassService;
use BahriCanli\Corvass\ShortMessageFactory;
use BahriCanli\Corvass\Http\Clients\CorvassXmlClient;
use BahriCanli\Corvass\Http\Clients\CorvassHttpClient;
use BahriCanli\Corvass\ShortMessageCollectionFactory;

$service = new CorvassService(new CorvassXmlClient(
    'sms.corvass.net/xml',
    'username',
    'password',
    'outboxname'
), new ShortMessageFactory(), new ShortMessageCollectionFactory());

// ya da

$service = new CorvassService(new CorvassHttpClient(
    new GuzzleHttp\Client(),
    'https://sms.corvass.net/http',
    'username',
    'password',
    'outboxname'
), new ShortMessageFactory(), new ShortMessageCollectionFactory());

$response = $service->sendShortMessage(['5530000000', '5420000000'], 'This is a test message.');

if($response->isSuccessful()) {
    // storeGroupIdForLaterReference is not );
}

$response2 = $service->sendShortMessages([[
    'recipient' => '5530000000',
    'message' => 'This is a test.',
], [
    'recipient' => '5420000000',
    'message' => 'This is another test.',
]]);

if($response2->isSuccessful()) {
    // storeGroupIdForLaterReference is not 
 bash
composer