PHPackages                             weijiajia/saloonphp-5sim - 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. weijiajia/saloonphp-5sim

ActiveLibrary[API Development](/categories/api)

weijiajia/saloonphp-5sim
========================

5SIM API client for SaloonPHP

011PHP

Since May 28Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/jackchang1025/saloonphp-5SIM)[ Packagist](https://packagist.org/packages/weijiajia/saloonphp-5sim)[ RSS](/packages/weijiajia-saloonphp-5sim/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SaloonPHP 5SIM 客户端
==================

[](#saloonphp-5sim-客户端)

[English Documentation](README.en.md) | 中文文档

该扩展包提供了一个基于 [SaloonPHP](https://docs.saloon.dev/) 构建的 [5SIM](https://5sim.net) API 客户端。5SIM 是一个提供虚拟电话号码服务的平台，可用于接收各类应用的短信验证码。

功能特点
----

[](#功能特点)

- 完整支持5SIM API的所有功能
- 使用PHP 8.1+原生枚举类型
- 基于SaloonPHP构建，易于扩展
- 类型安全的API交互方式
- 完善的异常处理机制

安装
--

[](#安装)

你可以通过 Composer 安装该扩展包：

```
composer require weijiajia/saloonphp-5sim
```

基本用法
----

[](#基本用法)

### 初始化客户端

[](#初始化客户端)

```
use Weijiajia\Saloonphp\FiveSim\FiveSimConnector;
use Weijiajia\Saloonphp\FiveSim\Enums\Operator;
use Weijiajia\Saloonphp\FiveSim\Enums\Product;

// 创建一个新的 5SIM 客户端实例
$connector = new FiveSimConnector('YOUR_5SIM_API_KEY');
$client = $connector->resource();
```

### 获取用户余额

[](#获取用户余额)

```
$response = $client->getBalance();
$balance = $response->json();
```

### 购买号码

[](#购买号码)

```
// 购买激活号码
$response = $client->buyNumber('russia', Operator::ANY_OPERATOR, Product::TELEGRAM);
$order = $response->json();

// 购买托管号码
$response = $client->buyHostingNumber('russia', Operator::ANY_OPERATOR, Product::TELEGRAM);
$order = $response->json();

// 重新购买号码
$response = $client->rebuyNumber(Product::TELEGRAM, '7912345678');
$order = $response->json();

// 批量购买号码
$response = $client->buyMultipleNumbers('russia', Operator::ANY_OPERATOR, Product::TELEGRAM, 5);
$orders = $response->json();

// 购买指定号码
$response = $client->buySpecificNumber('russia', Operator::ANY_OPERATOR, Product::TELEGRAM, '7912345678');
$order = $response->json();
```

### 查询产品和价格

[](#查询产品和价格)

```
// 获取国家列表
$response = $client->countries();
$countries = $response->json();

// 获取产品列表
$response = $client->productRequests('russia', Product::TELEGRAM);
$products = $response->json();

// 获取价格列表
$response = $client->priceRequests();
$prices = $response->json();

// 按国家获取价格列表
$response = $client->priceRequestsByCountry('russia');
$prices = $response->json();

// 按产品获取价格列表
$response = $client->priceRequestsByProduct(Product::TELEGRAM);
$prices = $response->json();

// 按国家和产品获取价格列表
$response = $client->priceRequestsByCountryAndProduct('russia', Product::TELEGRAM);
$prices = $response->json();
```

### 订单管理

[](#订单管理)

```
// 检查订单状态
$response = $client->checkOrder('12345678');
$orderStatus = $response->json();

// 完成订单
$response = $client->finishOrder('12345678');
$result = $response->json();

// 取消订单
$response = $client->cancelOrder('12345678');
$result = $response->json();

// 封禁订单
$response = $client->banOrder('12345678');
$result = $response->json();

// 获取短信收件箱列表
$response = $client->smsInboxList('12345678');
$messages = $response->json();
```

使用枚举类型
------

[](#使用枚举类型)

该扩展包提供了枚举类来帮助你正确地指定运营商和产品：

```
use Weijiajia\Saloonphp\FiveSim\Enums\Operator;
use Weijiajia\Saloonphp\FiveSim\Enums\Product;

// 使用预定义的运营商常量
$operator = Operator::ANY_OPERATOR;
$operator = Operator::BEELINE;
$operator = Operator::MEGAFON;
$operator = Operator::MTS;
$operator = Operator::TELE2;
// ... 等等

// 使用预定义的产品常量
$product = Product::TELEGRAM;
$product = Product::WHATSAPP;
$product = Product::FACEBOOK;
$product = Product::INSTAGRAM;
$product = Product::OPENAI;
// ... 等等
```

异常处理
----

[](#异常处理)

所有与API相关的错误都会抛出相应的异常，你可以使用 try/catch 块来处理这些异常：

```
use Saloon\Exceptions\Request\RequestException;

try {
    $response = $client->buyNumber('russia', Operator::ANY_OPERATOR, Product::TELEGRAM);
    $order = $response->json();
} catch (RequestException $e) {
    echo '发生错误：' . $e->getMessage();
    echo '响应状态码：' . $e->getResponse()->status();
    echo '响应内容：' . $e->getResponse()->body();
}
```

贡献
--

[](#贡献)

欢迎通过创建 issue 或者提交 pull request 来贡献代码。

许可证
---

[](#许可证)

该扩展包基于 MIT 许可证发布。详情请参阅 [LICENSE](LICENSE) 文件。

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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/636557533fde1107bb301eca908de1c17c9ea7073d5c9c0fbad725ccd0800bde?d=identicon)[jackchang1025](/maintainers/jackchang1025)

---

Top Contributors

[![422066139](https://avatars.githubusercontent.com/u/1780162?v=4)](https://github.com/422066139 "422066139 (11 commits)")

### Embed Badge

![Health badge](/badges/weijiajia-saloonphp-5sim/health.svg)

```
[![Health](https://phpackages.com/badges/weijiajia-saloonphp-5sim/health.svg)](https://phpackages.com/packages/weijiajia-saloonphp-5sim)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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