PHP code example of dilumsadeepa / dev-sms-gateway-laravel-package

1. Go to this page and download the library: Download dilumsadeepa/dev-sms-gateway-laravel-package 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/ */

    

dilumsadeepa / dev-sms-gateway-laravel-package example snippets


use Puppy\SmsGateway\Laravel\Facades\PuppySmsGateway;

// 1) Register (creates account only)
PuppySmsGateway::register('Alice', '[email protected]', 'StrongPass123');

// 2) Login
$login = PuppySmsGateway::login('[email protected]', 'StrongPass123');
$token = $login['token'];
PuppySmsGateway::setAuthToken($token);

// 3) Create environment (returns default environment API key)
$environment = PuppySmsGateway::createEnvironment(
    name: 'Production',
    pin: '1234',
    description: 'Main Android device',
    metadata: ['region' => 'us']
);

$apiKey = $environment['apiKey'];
PuppySmsGateway::setApiKey($apiKey);

// 4) Send SMS with environment API key
$send = PuppySmsGateway::send('+14075551234', 'Hello from Laravel package');

// 5) Poll status (uses API key by default)
$status = PuppySmsGateway::status($send['requestId']);

use Puppy\SmsGateway\Laravel\Facades\PuppySmsGateway;

$health = PuppySmsGateway::health();
$me = PuppySmsGateway::me();
$environments = PuppySmsGateway::environments();
$apiKeys = PuppySmsGateway::listApiKeys('<environment-id>');
$newKey = PuppySmsGateway::createApiKey('<environment-id>', 'backend-service');
$revoke = PuppySmsGateway::revokeApiKey('<environment-id>', '<key-id>');
$logs = PuppySmsGateway::logs(); // 
bash
php artisan vendor:publish --tag=puppy-sms-gateway-config