Download the PHP package virtualsmslabs/php-sdk without Composer
On this page you can find all versions of the php package virtualsmslabs/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download virtualsmslabs/php-sdk
More information about virtualsmslabs/php-sdk
Files in virtualsmslabs/php-sdk
Package php-sdk
Short Description PHP SDK for the VirtualSMS Consumer API — SMS verification, phone number rental, and activation management.
License MIT
Informations about the package php-sdk
VirtualSMS PHP SDK
PHP SDK for the VirtualSMS Consumer API — SMS verification, phone number rental, and activation management.
Requirements
- PHP 8.0 or higher
- cURL extension
- JSON extension
Installation
Quick Start
API Reference
Client Constructor
Methods
Account
getBalance(): BalanceResponse
Returns the current account balance.
Information & Pricing
getCountries(?string $poolProvider = null): array
Returns all available countries.
getServicesList(?int $country = null, ?string $lang = null): array
Returns available services for a country.
getOperators(int $country, ?string $poolProvider = null): array
Returns available mobile operators for a country.
getPrices(?string $service = null, ?int $country = null, ?string $poolProvider = null): array
Returns pricing data organized by country and service.
getPricesExtended(?string $service, ?int $country, ?bool $freePrice, ?string $poolProvider): array
Returns extended pricing with price tiers.
getPricesVerification(?string $service = null, ?string $poolProvider = null): array
Returns pricing in inverted format (service → country).
getNumbersStatus(int $country, ?string $operator = null, ?string $poolProvider = null): array
Returns available phone quantity per service.
getTopCountriesByService(string $service): array
Returns top 10 countries for a service, ranked by purchase share and success rate.
Ordering Numbers
getNumber(string $service, int $country, ...$options): NumberResponse
Orders a phone number. Returns text format response.
Options:
| Parameter | Type | Description |
|---|---|---|
maxPrice |
float |
Maximum price willing to pay |
operator |
string |
Mobile operator filter |
phoneException |
string |
Phone prefixes to exclude (comma-separated) |
forward |
bool |
Enable call forwarding |
activationType |
int |
Activation type: 0=SMS, 1=number, 2=voice |
language |
string |
Language for voice activation |
useCashBack |
bool |
Use cashback balance first |
userId |
string |
End-user ID for tracking |
ref |
string |
Referral ID |
poolProvider |
string |
Pool provider: alpha, prime, gamma, zeta |
getNumberV2(string $service, int $country, ...$options): array
Same as getNumber but returns JSON with additional fields. Supports orderId for idempotency.
Activation Management
setStatus(int $id, int $status): string
Changes activation status.
getStatus(int $id): StatusResponse
Returns activation status in text format.
getStatusV2(int $id): array
Returns activation status in JSON format with SMS/call details.
getActiveActivations(): array
Returns all currently active activations.
checkExtraActivation(int $id): array
Checks if a number is available for reactivation.
getExtraActivation(int $id): NumberResponse
Creates an extra activation on a previously used number.
Notifications
getNotifications(): array
Returns user notifications including penalties, low balance alerts, and admin messages.
Constants
ActivationStatus
PoolProvider
Error Handling
The SDK throws typed exceptions for all API errors. Each error code maps to a specific exception class:
Error Code Reference
| Error Code | Exception | Description |
|---|---|---|
BAD_KEY |
AuthenticationException |
Invalid API key |
BANNED |
AuthenticationException (HTTP 403) / RateLimitException (HTTP 429) |
Account banned / Rate limited |
PURCHASE_RESTRICTED |
AuthenticationException |
User restricted from purchasing |
SERVICE_RESTRICTED |
AuthenticationException |
Service restricted for account |
NO_BALANCE |
InsufficientBalanceException |
Insufficient balance |
NO_NUMBERS |
NoNumbersException |
No numbers available |
WRONG_SERVICE |
ValidationException |
Invalid service code |
WRONG_COUNTRY |
ValidationException |
Invalid country ID |
BAD_ACTION |
ValidationException |
Invalid action |
BAD_STATUS |
ValidationException |
Invalid status code |
NO_PRICES |
ValidationException |
No pricing data available |
INVALID_PROVIDER |
ValidationException |
Invalid pool provider |
NO_ACTIVATION |
ActivationException |
Activation not found |
WRONG_ACTIVATION_ID |
ActivationException |
Invalid activation ID |
EARLY_CANCEL_DENIED |
ActivationException |
Cannot cancel within 5 minutes |
RENEW_ACTIVATION_NOT_AVAILABLE |
ActivationException |
Number not available for reactivation |
CONCURRENT_LIMIT |
RateLimitException |
Too many concurrent activations |
ERROR_SQL |
ServerException |
Internal server error |
Tracking Headers
The SDK sends anonymous tracking headers with every request for analytics and debugging:
| Header | Value | Privacy |
|---|---|---|
X-SDK-Version |
1.1.0 |
SDK version string |
X-SDK-Language |
php |
SDK language |
X-SDK-Machine-Id |
SHA-256 hash of php_uname() + PHP SAPI (truncated to 32 chars) |
Irreversible hash — no hostname or IP exposed |
X-SDK-Timestamp |
ISO 8601 UTC timestamp | Request time |
No personally identifiable information is transmitted. The machine ID is a one-way hash and cannot be reversed to identify the source machine.
Rate Limiting
The API enforces rate limits and returns X-RateLimit-Limit and X-RateLimit-Remaining headers on every response. The SDK captures these automatically.
Checking Rate Limit Status
getRateLimitInfo() returns null before any request has been made, or if the API did not send rate-limit headers.
Handling Rate Limit Errors (HTTP 429)
When the rate limit is exceeded, the API returns HTTP 429 with a Retry-After header. The SDK throws a RateLimitException:
| Property | Type | Description |
|---|---|---|
$retryAfter |
int |
Seconds to wait before retrying (0 if not provided) |
$rateLimitLimit |
?int |
Maximum requests allowed in the window (null if absent) |
$rateLimitRemaining |
?int |
Remaining requests in the window (null if absent) |
The last successful getRateLimitInfo() is also available after a RateLimitException is caught, reflecting the rate-limit headers from the 429 response itself.
Custom Transport
By default, the SDK uses cURL for HTTP requests. You can provide your own transport implementation:
Examples
See the examples/ directory:
balance.php— Check account balanceorder_number.php— Order a phone numberfull_workflow.php— Complete SMS verification workflow
Testing
License
MIT — see LICENSE.
Links
All versions of php-sdk with dependencies
ext-curl Version *
ext-json Version *