PHP code example of hadi-aj / v2ray-panels

1. Go to this page and download the library: Download hadi-aj/v2ray-panels library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hadi-aj / v2ray-panels example snippets



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'   => '[email protected]',
    'limit'   => '5GB',
    'expiry'  => '2025-09-01',
]);