PHP code example of pasquale-cs / zipsms-php-sdk

1. Go to this page and download the library: Download pasquale-cs/zipsms-php-sdk 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/ */

    

pasquale-cs / zipsms-php-sdk example snippets


use ZipSms\ZipSmsClient;

$zip = ZipSmsClient::create($_ENV['ZIPSMS_API_KEY']); // base URL di default: https://zipsms-gateway.pcs.website

$res = $zip->sms()->send(
    to: '+393331234567',
    message: 'Ciao da ZipSMS!',
    deviceName: 'ufficio-1',  // oppure deviceId: 'tuo-device-id' (esattamente uno)
    reference: 'ordine-123', // opzionale
    // idempotencyKey: null → UUIDv4 automatico
);

echo $res['id'] . ' ' . $res['status']; // es. QUEUED

$zip->sms()->send($to, $msg, deviceId: $deviceId, reference: 'ordine-123', idempotencyKey: 'ordine-123');

$zip->sms()->get($smsId);
$zip->sms()->list(['status' => 'QUEUED', 'page' => 1, 'limit' => 20]);

$dash = ZipSmsClient::withSession($_ENV['ZIPSMS_SESSION_TOKEN']);

$dash->devices()->list();
$dash->devices()->create('ufficio-1', $fcmToken); // conserva il deviceToken cifrato!
$dash->devices()->rename($id, 'ufficio-2');
$dash->devices()->remove($id);
$dash->usage()->get();
$dash->app()->version(); // pubblico, niente auth

use ZipSms\Laravel\Facades\ZipSms;

ZipSms::sms()->send('+393331234567', 'Ciao!', deviceName: 'ufficio-1');
bash
php artisan vendor:publish --tag=zipsms-config