hadi-aj / v2ray-panels
A PHP client library for integrating with Sanaei and Marzban panels, providing a simple interface to manage and interact with VPN services programmatically.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/hadi-aj/v2ray-panels
Requires
- guzzlehttp/guzzle: ^7.9
README
A PHP client library for integrating with Sanaei (3x‑UI) and Marzban proxy/V2Ray/Xray management panels — providing a unified, code-friendly interface for panel automation.
🔧 Overview
- Designed to work with the 3x‑UI (Sanaei panel) and Marzban proxies management systems developed in Go/JS/Python.
- Exposes REST API access via PHP classes with type hints and PHPDoc for full IDE auto-completion and static analysis.
- Ideal for automating user management, client subscriptions, traffic monitoring, panel configuration, backups, and Telegram bot integrations.
🚀 Why Use This Library?
- Seamlessly integrates with panels like 3x‑UI/Sanaei and Marzban.
- Provides strongly-typed PHP classes to consume both panel APIs—no need to manually craft HTTP requests.
- PHPDoc-enhanced, so modern IDEs (PHPStorm, VSCode, etc.) offer parameter hints, return types, and in-line documentation.
🧩 Installation
Install via Composer:
composer require hadi-aj/v2ray-panels
🗂 Panel Support
- 3x‑UI (Sanaei panel): A fork of X‑UI supporting multi-protocol V2Ray/Xray inbound configuration, traffic limits, expiry, and more.
- Marzban panel: A modern GUI for Xray-core with REST API, multi-node support, share link generation, CLI, webhook, Telegram bot and system monitoring.
💡 Usage Examples
<?php require 'vendor/autoload.php'; use HadiAj\V2rayPanels\SanaeiClient; use HadiAj\V2rayPanels\MarzbanClient; $sanaei = new SanaeiClient('https://panel.example.com', 'API_TOKEN'); $marzban = new MarzbanClient('https://marzban.example.com/api', 'API_TOKEN'); // Fetch all clients from Sanaei $sanaeiClients = $sanaei->getClients(); // Create a new client on Marzban $new = $marzban->createClient([ 'email' => 'user@example.com', 'limit' => '5GB', 'expiry' => '2025-09-01', ]);
⚙️ Key Features
- ✅ Unified PHP API for both Sanaei and Marzban panels
- ✅ Fully documented classes/interfaces powered by PHPDoc for IntelliSense
- ✅ Client/inbound/tracking/subscription management with CRUD support
- ✅ Traffic stats, usage limits, expiry notifications via Telegram bots or webhooks
- 🌐 Supports multi-node Marzban deployment and panel configuration features
- 🔐 Secure access with token-based authentication, SSL support, and safe HTTP operations
📝 Documentation & API Reference
Full API endpoints and parameter references are documented in PHPDoc. You can also inspect the original panel docs:
- Marzban: https://github.com/gozargah/marzban
- Sanaei (3x‑UI): https://github.com/MHSanaei/3x-ui
🤝 Contribution
Contributions are welcome! Suggestions, bug reports, or feature additions:
- Fork the repository
- Develop your feature or fix
- Submit a pull request
Please follow PSR‑12 coding standards and include relevant tests for new features.
📄 License
Licensed under MIT License. See LICENSE file in the repository.