PHP code example of kwarcek / orange-smartsms-api

1. Go to this page and download the library: Download kwarcek/orange-smartsms-api 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/ */

    

kwarcek / orange-smartsms-api example snippets


use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use Kwarcek\OrangeSmartsmsApi\DTO\SMSMessage;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

// Create a new Guzzle client and MessagingRequest instance
$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

// Define the SMS message
$message = new SMSMessage([
    'sender' => 'YourSenderID', 
    'recipient' => '48510123456', // Recipient's phone number
    'content' => 'Hello from Orange SmartSMS!',
]);

// Send the SMS
$response = $messagingRequest->sendSMS($message, true);

print_r($response);

use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

$id = '54510a5d0361'; // Example message ID
$response = $messagingRequest->checkDeliveryStatus($id);

print_r($response);

use Kwarcek\OrangeSmartsmsApi\Requests\MessagingRequest;
use GuzzleHttp\Client;

$isDev = getenv('APP_ENV');

$client = new Client([
    'base_uri' => $isDev ? 'https://apib2b-test.orange.pl/' : 'https://apib2b.orange.pl/',
]);
$apiKey = 'your-api-key-here';

$messagingRequest = new MessagingRequest($client, $apiKey);

$response = $messagingRequest->checkLimit();

print_r($response);