PHPackages                             bl4ckp4nd4/sanaei-api - 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. bl4ckp4nd4/sanaei-api

ActiveLibrary

bl4ckp4nd4/sanaei-api
=====================

Connect to Sanaei Panel

v1.0(1y ago)119↓100%MITPHP

Since Jan 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/B14ckP4nd4/SanaeiApi)[ Packagist](https://packagist.org/packages/bl4ckp4nd4/sanaei-api)[ RSS](/packages/bl4ckp4nd4-sanaei-api/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Sanaei API Wrapper
==================

[](#sanaei-api-wrapper)

This PHP package provides an easy-to-use wrapper for interacting with the Sanaei API ( [3x-ui](https://github.com/MHSanaei/3x-ui) ). It allows you to manage inbounds, clients, and other resources through a convenient set of methods.

---

Features
--------

[](#features)

- Login and session management.
- Retrieve, update, and manage inbounds.
- Add and manage clients for inbounds.
- Traffic and IP management.

---

Road Map
--------

[](#road-map)

- **create standard package**
- **simple Documents**
- **publish on packagist**
- add examples
- publish Persian Documents

---

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

[](#installation)

You can install this package via Composer:

```
composer require bl4ckp4nd4/sanaei-api
```

---

Usage
-----

[](#usage)

- official 3x-ui API document: ( [Documents](https://www.postman.com/hsanaei/3x-ui/collection/q1l5l0u/3x-ui) )

### Initialization

[](#initialization)

```
use Bl4ckp4nd4\SanaeiApi\Sanaei;

$api = new Sanaei(
    url: 'example.com',
    username: 'your_username',
    password: 'your_password',
    webPath: 'panel', // Optional
    port: 443,        // Optional
    protocol: 'https' // Optional
);
```

### Login

[](#login)

```
$response = $api->login();
if ($response['success']) {
    echo "Login successful!";
} else {
    echo "Login failed: " . $response['msg'];
}
```

### Retrieve Inbounds

[](#retrieve-inbounds)

```
$inbounds = $api->inbounds();
if ($inbounds['success']) {
    print_r($inbounds['data']);
} else {
    echo "Failed to retrieve inbounds: " . $inbounds['msg'];
}
```

### Add a Client

[](#add-a-client)

```
$response = $api->addClient(
    id: 'inbound_id',
    uuid: 'client_uuid',
    email: 'client@example.com',
    totalgb: 100,
    eT: time() + (30 * 24 * 60 * 60), // Expire in 30 days
    limitIp: 1,
    subId: 'unique_subscription_id'
);

if ($response['success']) {
    echo "Client added successfully!";
} else {
    echo "Failed to add client: " . $response['msg'];
}
```

### Update an Inbound

[](#update-an-inbound)

```
$response = $api->updateInbound(
    inboundId: 1,
    up: 1000000,
    down: 1000000,
    total: 2000000,
    remark: 'Updated Inbound',
    enable: true,
    expiryTime: time() + (7 * 24 * 60 * 60), // Expire in 7 days
    listen: '',
    port: 8080,
    protocol: 'vless',
    settings: [],
    streamSettings: [],
    sniffing: [],
    allocate: []
);

if ($response['success']) {
    echo "Inbound updated successfully!";
} else {
    echo "Failed to update inbound: " . $response['msg'];
}
```

### Clear Client IPs

[](#clear-client-ips)

```
$response = $api->clearClientIps('client@example.com');
if ($response['success']) {
    echo "Client IPs cleared successfully!";
} else {
    echo "Failed to clear client IPs: " . $response['msg'];
}
```

---

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

[](#requirements)

- PHP &gt;= 7.4
- Composer
- cURL extension

---

Contributing
------------

[](#contributing)

Contributions are welcome! Feel free to submit a pull request or open an issue for bugs or feature requests.

---

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

Author
------

[](#author)

Created by [Bl4ckP4nd4](https://github.com/Bl4ckP4nd4).

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance45

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

432d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0cd11d1b9778c05a825a1d63eedb23897ccfd562ef90a7a90c4119e6fcdff426?d=identicon)[B14ckP4nd4](/maintainers/B14ckP4nd4)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/bl4ckp4nd4-sanaei-api/health.svg)

```
[![Health](https://phpackages.com/badges/bl4ckp4nd4-sanaei-api/health.svg)](https://phpackages.com/packages/bl4ckp4nd4-sanaei-api)
```

PHPackages © 2026

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