PHP code example of mrwebappdeveloper / hiddify-api-php

1. Go to this page and download the library: Download mrwebappdeveloper/hiddify-api-php 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/ */

    

mrwebappdeveloper / hiddify-api-php example snippets




new hiddifyApi(
    '', //! https://domain.com
    '', //! hiddify hidden path
    '' //! admin secret
);

$api->is_connected(); // return bool

$api->getSystemStats(); // return array


/////----------- USER API -----------\\\\\

//! if success return user uuid else return false
$api->user()->create(name: 'MrWebappDeveloper',
                    package_days: 30,
                    package_size: 30,
                    telegram_id: null, // optional
                    comment: null, // optional
                    resetMod: 'no_reset'); // 'no_reset' default
                    
//! if success return user uuid else return false
$api->user()->update(name: 'MrWebappDeveloper',
                    package_days: 30,
                    package_size: 30,
                    uuid: "user uuid"
                    telegram_id: null, // optional
                    comment: null, // optional
                    resetMod: 'no_reset'); // 'no_reset' default
                    
$api->user()->delete(string $uuid); // returns bool

$api->user()->list(); // return array

$api->user()->find(string $uuid); // returns user details in an array and returns null if can't find.