monovm / airalo-sdk
Airalo 合作伙伴 API PHP SDK
Requires
- php: >=7.4
- phpunit/phpunit: ^9.5||^10.5
Requires (Dev)
- phpstan/phpstan: ^1.10
README
Airalo 的 PHP SDK 提供与 RESTful API 的极简集成,并在其之上添加了额外的安全层。
SDK 支持
- 自动身份验证和加密
- 自动缓存和速率限制处理
- 本地、全局、国家和所有组合的软件包检索
- 端点上的软件包自动分页
- 软件包排序
- 批量订购软件包,允许一次性购买不同软件包和数量
- 软件包充值订购
- 统一的
EasyAccess
类型响应格式,允许作为关联数组或对象同时进行键访问,无需使用 json_decode - 兼容 Unix、macOS、Windows 操作系统
需求
- PHP 版本 >=
7.4
cURL
扩展已在 php.ini 中启用(默认启用)sodium
扩展已在 php.ini 中启用(默认启用)
自动加载
强烈建议始终使用 composer
作为依赖项管理,并简单地通过运行此 CLI 命令来要求 Airalo 的 SDK:
composer require airalo/sdk
然后在您的代码库中,通过已要求 autoload.php
文件,您将能够访问 Airalo
类。
对于旧项目或尚未使用 composer 的项目,请确保从 SDK 中要求 alo.php
自定义自动加载器
<?php require_once __DIR__ . '/alo.php';
初始化
- 对象使用
<?php require __DIR__ . '/vendor/autoload.php'; // require_once __DIR__ . '/alo.php'; // if not using composer use Airalo\Airalo; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', // mandatory 'client_secret' => '<YOUR_API_CLIENT_SECRET>', // mandatory 'env' => 'sandbox', // optional, defaults to `production` ]); $allPackages = $alo->getAllPackages(true);
- 静态使用
<?php require __DIR__ . '/vendor/autoload.php'; // require_once __DIR__ . '/alo.php'; // if not using composer use Airalo\AiraloStatic; // `init` must be called before using any of the methods otherwise an AiraloException will be thrown AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', // mandatory 'client_secret' => '<YOUR_API_CLIENT_SECRET>', // mandatory 'env' => 'sandbox', // optional, defaults to `production` ]); $allPackages = AiraloStatic::getAllPackages(true);
EasyAccess 响应
SDK 提供了一种简单而强大的方式来与响应对象交互。
默认情况下,您将能够以关联数组或对象的形式访问它们,而无需修改它们。
示例
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = $alo->getAllPackages(true); // fully accessed as an object without any changes of the response $packageId = $allPackages->data->{0}->package_id; // fully accessed as an associative array without any changes of the response $packageId = $allPackages['data'][0]['package_id']; // mixed usage $packageId = $allPackages['data'][0]->package_id; // easy string convert to raw JSON format $jsonString = (string)$allPackages;
方法接口
软件包
注意
将true
传递给$flat
参数将使响应变得更加紧凑且易于处理。然而,它与端点返回的主要响应不同。请考虑在哪些情况下需要原始版本,以及在哪些情况下需要紧凑版本。祝您编码愉快!
public function getAllPackages(bool $flat = false, $limit = null, $page = null): ?EasyAccess
检索所有 Airalo 的软件包。默认情况下,响应将与软件包 REST 端点相同(更多信息:[链接](https://partners-doc.airalo.com/#d775be27-4c08-45d1-9faa-8ec2c4f97bf5))。将 $flat
作为 true 将返回单个数据对象中的软件包对象数据,例如:
{ "data": [ { "package_id": "meraki-mobile-7days-1gb", "slug": "greece", "type": "sim", "price": 5, "net_price": 4, "amount": 1024, "day": 7, "is_unlimited": false, "title": "1 GB - 7 Days", "data": "1 GB", "short_info": "This eSIM doesn't come with a phone number.", "voice": null, "text": null, "plan_type": "data", "activation_policy": "first-usage", "operator": { "title": "Meraki Mobile", "is_roaming": true, "info": [ "LTE Data-only eSIM.", "Rechargeable online with no expiry.", "Operates on the Wind network in Greece." ] }, "countries": [ "GR" ] }, { "package_id": "meraki-mobile-7days-1gb-topup", "slug": "greece", "type": "topup", "price": 5, "net_price": 4, "amount": 1024, "day": 7, "is_unlimited": false, "title": "1 GB - 7 Days", "data": "1 GB", "short_info": null, "voice": null, "text": null, "plan_type": "data", "activation_policy": "first-usage", "operator": { "title": "Meraki Mobile", "is_roaming": true, "info": [ "LTE Data-only eSIM.", "Rechargeable online with no expiry.", "Operates on the Wind network in Greece." ] }, "countries": [ "GR" ] } ] }
默认情况下,如果没有 $limit
,则不应用软件包数量限制。
默认情况下,将分页所有页面(多个调用)或如果提供了 $page
,则将是起始分页索引。
public function getLocalPackages(bool $flat = false, $limit = null, $page = null): ?EasyAccess
检索本地 Airalo 软件包。默认情况下,响应将与软件包 REST 端点相同(更多信息:[链接](https://partners-doc.airalo.com/#d775be27-4c08-45d1-9faa-8ec2c4f97bf5))。将 $flat
作为 true 将返回单个数据对象中的软件包对象数据。
默认情况下,如果没有 $limit
,则不应用软件包数量限制。
默认情况下,将分页所有页面(多个调用)或如果提供了 $page
,则将是起始分页索引。
public function getGlobalPackages(bool $flat = false, $limit = null, $page = null): ?EasyAccess
获取全球Airalo套餐。默认情况下,响应将与来自packages REST端点的响应相同(更多信息请参见:https://partners-doc.airalo.com/#d775be27-4c08-45d1-9faa-8ec2c4f97bf5)。将$flat
设置为true将返回单个数据对象中的套餐对象数据。
默认情况下,如果没有 $limit
,则不应用软件包数量限制。
默认情况下,将分页所有页面(多个调用)或如果提供了 $page
,则将是起始分页索引。
public function getCountryPackages(string $countryCode, bool $flat = false, $limit = null): ?EasyAccess
获取特定国家的Airalo套餐。默认情况下,响应将与来自packages REST端点的响应相同(更多信息请参见:https://partners-doc.airalo.com/#d775be27-4c08-45d1-9faa-8ec2c4f97bf5)。将$flat
设置为true将返回单个数据对象中的套餐对象数据。
默认情况下,如果没有 $limit
,则不应用软件包数量限制。
默认情况下,将分页所有页面(多个调用)或如果提供了 $page
,则将是起始分页索引。
public function getSimPackages(bool $flat = false, $limit = null, $page = null): ?EasyAccess
获取仅包含SIM的Airalo套餐,不含充值。默认情况下,响应将与来自packages REST端点的响应相同(更多信息请参见:https://partners-doc.airalo.com/#d775be27-4c08-45d1-9faa-8ec2c4f97bf5)。将$flat
设置为true将返回单个数据对象中的套餐对象数据。
默认情况下,如果没有 $limit
,则不应用软件包数量限制。
默认情况下,将分页所有页面(多个调用)或如果提供了 $page
,则将是起始分页索引。
订单
public function order(string $packageId, int $quantity, ?string $description = null): ?EasyAccess
为给定的套餐ID(从任何套餐调用中获取)下订单,并调用REST API的order
端点。完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#768fbbc7-b649-4fb5-9755-be579333a2d9
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = $alo->getAllPackages(true); $packageId = $allPackages->data->{0}->package_id; $order = $alo->order($packageId, 1); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = AiraloStatic::getAllPackages(true); $packageId = $allPackages->data->{0}->package_id; $order = AiraloStatic::order($packageId, 1);
public function orderBulk(array $packages, ?string $description = null): ?EasyAccess
参数:数组 $packages
,其中键是套餐名称,值表示所需的数量。在同一函数调用中对多个套餐(最多50个不同的套餐ID)进行并行订单。示例用法
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = $alo->getAllPackages(true); $firstPackageId = $allPackages['data'][0]->package_id; $secondPackageId = $allPackages['data'][1]->package_id; $thirdPackageId = $allPackages['data'][2]->package_id; $orders = $aa->orderBulk([ $firstPackageId => 2, $secondPackageId => 1, ]); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = AiraloStatic::getAllPackages(true); $firstPackageId = $allPackages['data'][0]->package_id; $secondPackageId = $allPackages['data'][1]->package_id; $thirdPackageId = $allPackages['data'][2]->package_id; $orders = AiraloStatic::orderBulk([ $firstPackageId => 2, $secondPackageId => 1, ]);
示例响应
{ "change-7days-1gb": { "data": { "id": 77670, "code": "20240514-077670", "currency": "USD", "package_id": "change-7days-1gb", "quantity": 1, "type": "sim", "description": "Bulk order placed via Airalo PHP SDK", "esim_type": "Prepaid", "validity": 7, "package": "Change-1 GB - 7 Days", "data": "1 GB", "price": 4.5, "created_at": "2024-05-14 11:48:47", "manual_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To manually activate the eSIM on your eSIM capable device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Manually enter the SM-DP+ Address and activation code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "qrcode_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To activate the eSIM by scanning the QR code on your eSIM capable device you need to print or display this QR code on other device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Scan QR code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "installation_guides": { "en": "https://www.airalo.com/help/getting-started-with-airalo" }, "text": null, "voice": null, "net_price": 3.6, "sims": [ { "id": 102795, "created_at": "2024-05-14 11:48:47", "iccid": "893000000000034143", "lpa": "lpa.airalo.com", "imsis": null, "matching_id": "TEST", "qrcode": "LPA:1$lpa.airalo.com$TEST", "qrcode_url": "https://sandbox.airalo.com/qr?expires=1802000927&id=137975&signature=b4e731d218fdc707b677c89d54d41773d250a38c160cf7d97f6e9493b5fec0ee", "airalo_code": null, "apn_type": "automatic", "apn_value": null, "is_roaming": true, "confirmation_code": null, "apn": { "ios": { "apn_type": "automatic", "apn_value": null }, "android": { "apn_type": "automatic", "apn_value": null } }, "msisdn": null }, { "id": 102795, "created_at": "2024-05-14 11:48:47", "iccid": "893000000000034143", "lpa": "lpa.airalo.com", "imsis": null, "matching_id": "TEST", "qrcode": "LPA:1$lpa.airalo.com$TEST", "qrcode_url": "https://sandbox.airalo.com/qr?expires=1802000927&id=137975&signature=b4e731d218fdc707b677c89d54d41773d250a38c160cf7d97f6e9493b5fec0ee", "airalo_code": null, "apn_type": "automatic", "apn_value": null, "is_roaming": true, "confirmation_code": null, "apn": { "ios": { "apn_type": "automatic", "apn_value": null }, "android": { "apn_type": "automatic", "apn_value": null } }, "msisdn": null } ] }, "meta": { "message": "success" } }, "change-7days-1gb-topup": { "data": { "id": 77671, "code": "20240514-077671", "currency": "USD", "package_id": "change-7days-1gb-topup", "quantity": 1, "type": "sim", "description": "Bulk order placed via Airalo PHP SDK", "esim_type": "Prepaid", "validity": 7, "package": "Change-1 GB - 7 Days", "data": "1 GB", "price": 4.5, "created_at": "2024-05-14 11:48:47", "manual_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To manually activate the eSIM on your eSIM capable device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Manually enter the SM-DP+ Address and activation code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "qrcode_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To activate the eSIM by scanning the QR code on your eSIM capable device you need to print or display this QR code on other device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Scan QR code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "installation_guides": { "en": "https://www.airalo.com/help/getting-started-with-airalo" }, "text": null, "voice": null, "net_price": 3.6, "sims": [ { "id": 102796, "created_at": "2024-05-14 11:48:47", "iccid": "893000000000034144", "lpa": "lpa.airalo.com", "imsis": null, "matching_id": "TEST", "qrcode": "LPA:1$lpa.airalo.com$TEST", "qrcode_url": "https://sandbox.airalo.com/qr?expires=1802000927&id=137976&signature=978adede2174b6de7d2502841d6d901d417d643570dd6172c71733cde5f72503", "airalo_code": null, "apn_type": "automatic", "apn_value": null, "is_roaming": true, "confirmation_code": null, "apn": { "ios": { "apn_type": "automatic", "apn_value": null }, "android": { "apn_type": "automatic", "apn_value": null } }, "msisdn": null } ] }, "meta": { "message": "success" } } }
注意
每个套餐ID是返回响应中的一个键。代表从初始调用中订购的sims
对象的数量。
如果并行订单中的任何一个发生错误,错误REST响应将被分配给套餐ID键,因此您必须确保验证每个响应
示例
{ "change-7days-1gb": {"data":{"quantity":"The quantity may not be greater than 50."},"meta":{"message":"the parameter is invalid"}}, "change-7days-1gb-topup": { "data": { "id": 77671, "code": "20240514-077671", "currency": "USD", "package_id": "change-7days-1gb-topup", "quantity": 1, "type": "sim", "description": "Bulk order placed via Airalo PHP SDK", "esim_type": "Prepaid", "validity": 7, "package": "Change-1 GB - 7 Days", "data": "1 GB", "price": 4.5, "created_at": "2024-05-14 11:48:47", "manual_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To manually activate the eSIM on your eSIM capable device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Manually enter the SM-DP+ Address and activation code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "qrcode_installation": "<p><b>eSIM name:</b> Change</p><p><b>Coverage: </b>United States</p><p><b>To activate the eSIM by scanning the QR code on your eSIM capable device you need to print or display this QR code on other device:</b></p><ol><li>Settings > Cellular/Mobile > Add Cellular/Mobile Plan.</li><li>Scan QR code.</li><li>Confirm eSIM plan details.</li><li>Label the eSIM.</li></ol><p><b>To access Data:</b></p><ol><li>Enable data roaming.</li></ol>", "installation_guides": { "en": "https://www.airalo.com/help/getting-started-with-airalo" }, "text": null, "voice": null, "net_price": 3.6, "sims": [ { "id": 102796, "created_at": "2024-05-14 11:48:47", "iccid": "893000000000034144", "lpa": "lpa.airalo.com", "imsis": null, "matching_id": "TEST", "qrcode": "LPA:1$lpa.airalo.com$TEST", "qrcode_url": "https://sandbox.airalo.com/qr?expires=1802000927&id=137976&signature=978adede2174b6de7d2502841d6d901d417d643570dd6172c71733cde5f72503", "airalo_code": null, "apn_type": "automatic", "apn_value": null, "is_roaming": true, "confirmation_code": null, "apn": { "ios": { "apn_type": "automatic", "apn_value": null }, "android": { "apn_type": "automatic", "apn_value": null } }, "msisdn": null } ] }, "meta": { "message": "success" } } }
优惠券
public function voucher(int $usageLimit, int $amount, int $quantity, ?bool $isPaid = false, string $voucherCode = null): ?EasyAccess
调用REST API的voucher
端点。完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#768fbbc7-b649-4fb5-9755-be579333a2d9
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $vouchers = $alo->voucher( 40, 22, 1, false,'ABC111'); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $vouchers = AiraloStatic::voucher(40, 22, 1, false,'ABC111');
示例响应
{ "data": { "id": 8, "code": "ABC111", "usage_limit": 40, "amount": 22, "is_paid": false, "created_at": "2024-06-10 07:23:24" }, "meta": { "message": "success" } }
ESim优惠券
public function esimVouchers(array $vouchers): ?EasyAccess
调用REST API的voucher/esim
端点。完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#5a48bb8d-70d1-4030-ad92-4a82eb979281
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $vouchers = $alo->esimVouchers([ [ "package_id": "package_slug", "quantity": 2 ] ]); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $vouchers = AiraloStatic::esimVouchers([ [ "package_id": "package_slug", "quantity": 1 ] ]);
示例响应
{ "data": [ { "package_id": "package_slug", "codes": [ "BIXLAAAA", "BSXLAAAA" ] } ], "meta": { "message": "success" } }
充值
public function topup(string $packageId, string $iccid, ?string $description = null): ?EasyAccess
为给定的套餐ID和eSIM的ICCID放置充值,并调用REST API的topups
端点。
完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#e411d932-2993-463f-a548-754c47ac7c00
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = $alo->getAllPackages(true); $packageId = $allPackages->data->{0}->package_id; $order = $alo->order($packageId, 1); $iccid = $orders['bul-7gb-3days']['data']['sims'][0]['iccid']; $topup = $alo->topup($packageId, $iccid); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $allPackages = AiraloStatic::getAllPackages(true); $packageId = $allPackages->data->{0}->package_id; $order = AiraloStatic::order($packageId, 1); $iccid = $orders['bul-7gb-3days']['data']['sims'][0]['iccid']; $topup = AiraloStatic::topup($packageId, $iccid);
Sim使用情况
public function simUsage(string $iccid): ?EasyAccess
放置一个带有用户ICCID的$iccid,并调用REST API的simUsage
端点。
完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#e411d932-2993-463f-a548-754c47ac7c00
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $topup = $alo->simUsage($iccid); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $topup = AiraloStatic::simUsage($iccid);
示例响应可以在API文档中找到(上面的链接)。
Sim说明
public function getSimInstructions(string $iccid, string $language = "en"): ?EasyAccess
放置一个带有用户ICCID的$iccid和一个语言如en、de的$language。默认为en,并调用REST API的getSimInstructions
端点。完整的响应示例可以在这里找到:https://partners-doc.airalo.com/#768fbbc7-b649-4fb5-9755-be579333a2d9
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Airalo; use Airalo\AiraloStatic; $alo = new Airalo([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $instructions = $alo->getSimInstructions('893000000000002115'); // // Static usage // AiraloStatic::init([ 'client_id' => '<YOUR_API_CLIENT_ID>', 'client_secret' => '<YOUR_API_CLIENT_SECRET>', ]); $order = AiraloStatic::getSimInstructions('893000000000002115');
示例响应
{ "data": { "instructions": { "language": "EN", "ios": [ { "model": null, "version": "15.0,14.0.,13.0,12.0", "installation_via_qr_code": { "steps": { "1": "Go to Settings > Cellular/Mobile > Add Cellular/Mobile Plan.", "2": "Scan the QR Code.", "3": "Tap on 'Add Cellular Plan'.", "4": "Label the eSIM.", "5": "Choose preferred default line to call or send messages.", "6": "Choose the preferred line to use with iMessage, FaceTime, and Apple ID.", "7": "Choose the eSIM plan as your default line for Cellular Data and do not turn on 'Allow Cellular Data Switching' to prevent charges on your other line.", "8": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "qr_code_data": "5a30d830-cfa9-4353-8d76-f103351d53b6", "qr_code_url": "https://www.conroy.biz/earum-dolor-qui-molestiae-at" }, "installation_manual": { "steps": { "1": "Go to Settings > Cellular/Mobile > Add Cellular/Mobile Plan.", "2": "Tap on 'Enter Details Manually'.", "3": "Enter your SM-DP+ Address and Activation Code.", "4": "Tap on 'Add Cellular Plan'.", "5": "Label the eSIM.", "6": "Choose preferred default line to call or send messages.", "7": "Choose the preferred line to use with iMessage, FaceTime, and Apple ID.", "8": "Choose the eSIM plan as your default line for Cellular Data and do not turn on 'Allow Cellular Data Switching' to prevent charges on your other line.", "9": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "smdp_address_and_activation_code": "6a7f7ab6-6469-461d-8b17-2ee5c0207d22" }, "network_setup": { "steps": { "1": "Select your eSIM under 'Cellular Plans'.", "2": "Ensure that 'Turn On This Line' is toggled on.", "3": "Go to 'Network Selection' and select the supported network.", "4": "Need help? Chat with us." }, "apn_type": "manual", "apn_value": "globaldata", "is_roaming": null } }, { "model": null, "version": null, "installation_via_qr_code": { "steps": { "1": "Go to Settings > Cellular/Mobile Data > Add eSIM or Set up Cellular/Mobile Service > Use QR Code on your device. ", "2": "Scan the QR code available on the app, then tap “Continue” twice and wait for a while. Your eSIM will connect to the network, this may take a few minutes, then tap “Done”.", "3": "Choose a label for your new eSIM plan.", "4": "Choose “Primary” for your default line, then tap “Continue”.", "5": "Choose “Primary” you want to use with iMessage and FaceTime for your Apple ID, then tap “Continue”.", "6": "Choose your new eSIM plan for cellular/mobile data, then tap “Continue”." }, "qr_code_data": "5a30d830-cfa9-4353-8d76-f103351d53b6", "qr_code_url": "https://www.conroy.biz/earum-dolor-qui-molestiae-at" }, "installation_manual": { "steps": { "1": "Go to Settings > Cellular/Mobile Data > Add eSIM or Set up Cellular/Mobile Service > Use QR Code on your device.", "2": "Tap “Enter Details Manually” and enter the SM-DP+ Address and Activation Code available on the app by copying them, tap “Next”, then tap “Continue” twice and wait for a while. Your eSIM will connect to the network, this may take a few minutes, then tap “Done”.", "3": "Choose a label for your new eSIM plan.", "4": "Choose “Primary” for your default line, then tap “Continue”.", "5": "Choose “Primary” you want to use with iMessage and FaceTime for your Apple ID, then tap “Continue”.", "6": "Choose your new eSIM plan for cellular/mobile data, then tap “Continue”." }, "smdp_address_and_activation_code": "6a7f7ab6-6469-461d-8b17-2ee5c0207d22" }, "network_setup": { "steps": { "1": "Go to “Cellular/Mobile Data”, then select the recently downloaded eSIM on your device. Enable the “Turn On This Line” toggle, then select your new eSIM plan for cellular/mobile data. ", "2": "Tap “Network Selection”, disable the “Automatic” toggle, then select the supported network available on the app manually if your eSIM has connected to the wrong network." }, "apn_type": "manual", "apn_value": "globaldata", "is_roaming": null } } ], "android": [ { "model": null, "version": null, "installation_via_qr_code": { "steps": { "1": "Go to Settings > Connections > SIM Card Manager.", "2": "Tap on 'Add Mobile Plan'.", "3": "Tap on 'Scan Carrier QR Code' and tap on 'Add'.", "4": "When the plan has been registered, tap 'Ok' to turn on a new mobile plan.", "5": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "qr_code_data": "5a30d830-cfa9-4353-8d76-f103351d53b6", "qr_code_url": "https://www.conroy.biz/earum-dolor-qui-molestiae-at" }, "installation_manual": { "steps": { "1": "Go to Settings > Connections > SIM Card Manager.", "2": "Tap on 'Add Mobile Plan'.", "3": "Tap on 'Scan Carrier QR Code' and tap on 'Enter code instead'.", "4": "Enter the Activation Code (SM-DP+ Address & Activation Code).", "5": "When the plan has been registered, tap 'Ok' to turn on a new mobile plan.", "6": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "smdp_address_and_activation_code": "6a7f7ab6-6469-461d-8b17-2ee5c0207d22" }, "network_setup": { "steps": { "1": "In the 'SIM Card Manager' select your eSIM.", "2": "Ensure that your eSIM is turned on under 'Mobile Networks'.", "3": "Enable the Mobile Data.", "4": "Go to Settings > Connections > Mobile networks > Network Operators.", "5": "Ensure that the supported network is selected.", "6": "Need help? Chat with us." }, "apn_type": "automatic", "apn_value": "globaldata", "is_roaming": null } }, { "model": null, "version": null, "installation_via_qr_code": { "steps": { "1": "Go to Settings > Network & internet.", "2": "Tap on the '+' (Add) icon next to the Mobile network.", "3": "Tap 'Next' when asked, “Don’t have a SIM card?”.", "4": "Scan the QR Code.", "5": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "qr_code_data": "5a30d830-cfa9-4353-8d76-f103351d53b6", "qr_code_url": "https://www.conroy.biz/earum-dolor-qui-molestiae-at" }, "installation_manual": { "steps": { "1": "Go to Settings > Network & internet.", "2": "Tap on the '+' (Add) icon next to the Mobile network.", "3": "Tap on 'Next' when asked, “Don’t have a SIM card?”.", "4": "Tap 'Enter Code Manually'. You will be asked to enter your Activation Code (SM-DP+ Adress & Activation Code).", "5": "Your eSIM has been installed successfully, please scroll down to see the settings for accessing data." }, "smdp_address_and_activation_code": "6a7f7ab6-6469-461d-8b17-2ee5c0207d22" }, "network_setup": { "steps": { "1": "Go to Network & internet and tap on 'Mobile network'.", "2": "Connect manually to the supported network.", "3": "Turn on eSIM under 'Mobile network'.", "4": "Enable the Mobile Data.", "5": "Need help? Chat with us." }, "apn_type": "automatic", "apn_value": "globaldata", "is_roaming": null } }, { "model": "Galaxy", "version": "1", "installation_via_qr_code": { "steps": { "1": "Go to “Settings”, tap “Connections”, then tap “SIM card manager” on your device.", "2": "Tap “Add mobile plan”, then tap “Scan carrier QR code”.", "3": "Tap “Enter activation code”.", "4": "Enter the SM-DP+ Address & Activation Code by copying it, tap “Connect”, then tap “Confirm”." }, "qr_code_data": "5a30d830-cfa9-4353-8d76-f103351d53b6", "qr_code_url": "https://www.conroy.biz/earum-dolor-qui-molestiae-at" }, "installation_manual": { "steps": { "1": "Go to “Settings”, tap “Connections”, then tap “SIM card manager” on your device.", "2": "Tap “Add mobile plan”, then tap “Scan carrier QR code”.", "3": "Tap “Enter activation code”.", "4": "Enter the SM-DP+ Address & Activation Code by copying it, tap “Connect”, then tap “Confirm”." }, "smdp_address_and_activation_code": "6a7f7ab6-6469-461d-8b17-2ee5c0207d22" }, "network_setup": { "steps": { "1": "Go to “Settings”, tap “Connections”, then tap “SIM card manager” on your device.", "2": "Tap “Add mobile plan”, then tap “Scan carrier QR code”.", "3": "Tap “Enter activation code”.", "4": "Enter the SM-DP+ Address & Activation Code by copying it, tap “Connect”, then tap “Confirm”." }, "apn_type": "automatic", "apn_value": "globaldata", "is_roaming": null } } ] } }, "meta": { "message": "success" } }
技术说明
- 加密的认证令牌将自动在文件系统中缓存24小时。
- 缓存将自动存储在文件系统中,有效期为1小时。
- 使用Airalo和AiraloStatic中的
mock()
方法,可以无缝地进行单元测试的存根。 - SDK抛出的所有异常都是
AiraloException
的实例。 - 要清除所有缓存(不建议在生产环境中频繁清除缓存),您可以执行以下操作
<?php require __DIR__ . '/vendor/autoload.php'; use Airalo\Helpers\Cached; Cached::clearCache();