PHPackages                             touristesim/touristesim-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. touristesim/touristesim-php-sdk

ActiveLibrary[API Development](/categories/api)

touristesim/touristesim-php-sdk
===============================

Official PHP SDK for Tourist eSIM Partner API - Easy integration for resellers and partners

00PHP

Since Mar 19Pushed 2mo agoCompare

[ Source](https://github.com/touristesim/touristesim-php-sdk)[ Packagist](https://packagist.org/packages/touristesim/touristesim-php-sdk)[ RSS](/packages/touristesim-touristesim-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Tourist eSIM PHP SDK
====================

[](#tourist-esim-php-sdk)

Official PHP SDK for Tourist eSIM Partner API. Enable easy integration for resellers and partners to manage eSIM plans, orders, and customer data.

Features
--------

[](#features)

- 🔐 **OAuth 2.0 Authentication** - Secure Client Credentials flow with automatic token refresh
- 🚀 **Auto-Retry Logic** - Exponential backoff with 3 retry attempts on connection failures
- 📦 **Type-Safe Models** - Full type casting and helper methods on all models
- 💾 **Token Caching** - File-based token cache to reduce OAuth requests (1 per hour)
- ⚡ **Lazy Loading** - Resources initialized on first access for minimal memory footprint
- 🔄 **Pagination Support** - Built-in pagination for catalog queries
- 🎯 **Exception Hierarchy** - Specific exceptions for different error scenarios (Auth, Validation, RateLimit, etc.)

Requirements
------------

[](#requirements)

- PHP 8.1+
- cURL extension
- GuzzleHTTP 7.0+

Testing
-------

[](#testing)

Run the included test script to verify SDK functionality:

```
php test_sdk.php
```

This runs basic tests for SDK instantiation, resource classes, exception handling, and overall structure without making actual API calls.

Installation
------------

[](#installation)

Install via Composer:

```
composer require touristesim/touristesim-php-sdk
```

Quick Start
-----------

[](#quick-start)

### Basic Setup

[](#basic-setup)

```
require 'vendor/autoload.php';

use TouristeSIM\Sdk\TouristEsim;

$sdk = new TouristEsim(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret'
);

// Fetch all plans
$plans = $sdk->plans()->get();
foreach ($plans as $plan) {
    echo $plan['name'] . " - " . $plan['price'] . " " . $plan['currency'] . "\n";
}
```

### Authentication

[](#authentication)

The SDK handles OAuth 2.0 authentication automatically:

```
$sdk = new TouristEsim(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    options: [
        'base_url' => 'https://api.touristesim.net/v1',
        'timeout' => 30,
        'mode' => 'sandbox' // or 'production'
    ]
);

// Token is automatically acquired and cached
// Auto-refresh happens 60 seconds before expiration
```

API Usage
---------

[](#api-usage)

### Plans

[](#plans)

```
// Fetch all plans with filters
$plans = $sdk->plans()->get([
    'country' => 'US',
    'type' => 'global',
    'data_min' => 1024,  // in MB
    'sort_by' => 'price',
    'page' => 1,
    'per_page' => 50
]);

// Get single plan
$plan = $sdk->plans()->find(123);

// Get plans by country
$usPlans = $sdk->plans()->byCountry('US');

// Get plans by region
$asiaPlans = $sdk->plans()->byRegion('asia');

// Get global plans
$globalPlans = $sdk->plans()->global();

// Validate plan before purchase
$validation = $sdk->plans()->validate(planId: 123, quantity: 5);
```

### Countries

[](#countries)

```
// Get all countries
$countries = $sdk->countries()->all();

// Find country by ISO code
$usa = $sdk->countries()->find('US');

// Search countries
$asian = $sdk->countries()->search('china');

// Get countries by region
$europeanCountries = $sdk->countries()->byRegion('europe');

// Get featured countries
$featured = $sdk->countries()->featured();
```

### Regions

[](#regions)

```
// Get all regional groups
$regions = $sdk->regions()->all();
```

### Orders

[](#orders)

```
// Create order
$order = $sdk->orders()->create([
    'plan_id' => 123,
    'quantity' => 2,
    'customer_email' => 'customer@example.com',
    'coupon_code' => 'SAVE10' // optional
]);

// Get all orders
$orders = $sdk->orders()->all(['status' => 'completed']);

// Get single order
$order = $sdk->orders()->find(456);

// Cancel order
$cancelled = $sdk->orders()->cancel(456);
```

### eSIMs

[](#esims)

```
// Get all eSIMs
$esims = $sdk->esims()->all(['status' => 'active']);

// Find eSIM by ICCID
$esim = $sdk->esims()->find('8955001000000000000');

// Check eSIM usage
$usage = $sdk->esims()->usage('8955001000000000000');

// Get available topup packages
$packages = $sdk->esims()->topupPackages('8955001000000000000');

// Purchase topup
$topup = $sdk->esims()->topup(
    iccid: '8955001000000000000',
    packageId: 789
);

// Get setup instructions
$instructions = $sdk->esims()->instructions('8955001000000000000');

// Send setup email
$sdk->esims()->sendEmail('8955001000000000000', 'user@example.com');
```

### Account Balance

[](#account-balance)

```
// Get account balance
$balance = $sdk->balance()->get();

// Get balance history
$history = $sdk->balance()->history(['limit' => 50]);
```

Working with Collections
------------------------

[](#working-with-collections)

All list responses return Collection objects with helpful methods:

```
$plans = $sdk->plans()->get();

// Filter
$expensivePlans = $plans->filter(fn($plan) => $plan['price'] > 50);

// Map
$prices = $plans->map(fn($plan) => $plan['price']);

// Sort
$sorted = $plans->sortBy('price');

// Pluck
$names = $plans->pluck('name');

// Iteration
foreach ($plans as $plan) {
    // Use plan
}
```

Error Handling
--------------

[](#error-handling)

The SDK provides specific exceptions for different error scenarios:

```
use TouristeSIM\Sdk\Exceptions\{
    AuthenticationException,
    ValidationException,
    RateLimitException,
    ResourceNotFoundException,
    ServerException,
    ConnectionException
};

try {
    $plan = $sdk->plans()->find(999);
} catch (ResourceNotFoundException $e) {
    echo "Plan not found: " . $e->getMessage();
} catch (AuthenticationException $e) {
    echo "Authentication failed: " . $e->getMessage();
} catch (RateLimitException $e) {
    echo "Rate limited. Retry after: " . $e->getRetryAfter() . " seconds";
} catch (ValidationException $e) {
    echo "Validation error: " . json_encode($e->getErrors());
} catch (ConnectionException $e) {
    echo "Connection failed: " . $e->getMessage();
} catch (ServerException $e) {
    echo "Server error: " . $e->getMessage();
}
```

Configuration Options
---------------------

[](#configuration-options)

```
$options = [
    'base_url' => 'https://api.touristesim.net/v1', // API base URL
    'timeout' => 30,                                  // Request timeout (seconds)
    'connect_timeout' => 10,                          // Connection timeout (seconds)
    'mode' => 'sandbox',                              // 'sandbox' or 'production'
    'verify_ssl' => true,                             // SSL certificate verification
    'max_retries' => 3,                               // Max retry attempts
];

$sdk = new TouristEsim(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    options: $options
);
```

Pagination
----------

[](#pagination)

Paginated responses include metadata:

```
$plans = $sdk->plans()->get(['page' => 1, 'per_page' => 50]);

echo "Current page: " . $plans->getCurrentPage();
echo "Total pages: " . $plans->getLastPage();
echo "Total items: " . $plans->getTotal();
echo "Has more: " . ($plans->hasMore() ? 'Yes' : 'No');

// Iterate through paginated results
foreach ($plans as $plan) {
    // Process plan
}
```

Token Management
----------------

[](#token-management)

Tokens are automatically managed:

```
// Tokens are cached in sys_get_temp_dir()
// Cache file: tourist_esim_token_[hash].json
// Permissions: 0600 (owner-only readable)

// Token is automatically refreshed when expired (60-second buffer)
// No manual token management required
```

Debugging
---------

[](#debugging)

Enable detailed logging by catching exceptions:

```
try {
    $plans = $sdk->plans()->get();
} catch (\Exception $e) {
    echo "Error code: " . $e->getCode() . "\n";
    echo "Error message: " . $e->getMessage() . "\n";

    if (method_exists($e, 'getResponse')) {
        echo "Response body: " . $e->getResponse() . "\n";
    }
}
```

API Documentation
-----------------

[](#api-documentation)

For complete API documentation, visit:

- **API Docs**:
- **SDK Guides**:
- **Partner Dashboard**:

Support
-------

[](#support)

For issues or questions:

- **Technical Support**:
- **GitHub Issues**:
- **Dashboard**:

License
-------

[](#license)

MIT License - see LICENSE file for details

Changelog
---------

[](#changelog)

### v1.0.0 (2026-02-18)

[](#v100-2026-02-18)

- Initial public release
- OAuth 2.0 authentication with auto-refresh
- Plans, Countries, Regions, Orders, eSIMs resources
- Auto-retry with exponential backoff
- Token caching
- Collection support with filtering and mapping
- Comprehensive error handling

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance55

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd8b9a1414920a0be694b32090cd60185b5167528275ebc022765dea22aec6bc?d=identicon)[touristesim](/maintainers/touristesim)

---

Tags

api-sdkesimesim-apiesim-reselleresim-sdkpartner-apiphp-sdkresellertourist-esimtouristesimtravel-esim

### Embed Badge

![Health badge](/badges/touristesim-touristesim-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/touristesim-touristesim-php-sdk/health.svg)](https://phpackages.com/packages/touristesim-touristesim-php-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
