PHP
SDK
PHP SDK
Official PHP SDK with full Laravel integration support. Compatible with PHP 8.0+.
PHP 8.0+
Composer
Laravel 9+
Installation
Composer
composer require directsms/sdk
Basic Usage
Initialize Client
<?php use DirectSMS\Client; // Initialize the client $client = new Client('YOUR_API_TOKEN'); // Get user info $user = $client->user()->me(); echo $user->balance;
SMS Activation
Create Activation
// Get available categories $categories = $client->sms()->categories(); // Create new activation $activation = $client->sms()->create([ 'category_id' => 15, 'country' => 'US' ]); echo $activation->phone; // +1234567890 // Wait for SMS $sms = $client->sms()->waitForCode($activation->id, 120); echo $sms->code; // 123456
Laravel Integration
config/services.php
// Add to config/services.php 'directsms' => [ 'token' => env('DIRECTSMS_TOKEN'), ], // Use via Facade use DirectSMS\Facades\DirectSMS; $user = DirectSMS::user()->me();