PHP code example of xiaohuilam / ultimate-debug-tool

1. Go to this page and download the library: Download xiaohuilam/ultimate-debug-tool 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/ */

    

xiaohuilam / ultimate-debug-tool example snippets


Xiaohuilam\UltDebug\ServiceProvider::class,



use Xiaohuilam\UltDebug\App;
use Xiaohuilam\UltDebug\RegExp;
use Xiaohuilam\UltDebug\Store;
use Xiaohuilam\UltDebug\StoreGet;
use Xiaohuilam\UltDebug\StoreSet;


public function YourControllerAction() {
    $debug = new App();

    $debug->appendGroup('Group 1', [
        [
            'Register' => [
                'Captcha' => [
                    'url' => '/user/captcha',
                    'data' => [ ],
                    'done' => [
                        Store::set('captcha_ticket', 'json.data.captcha_ticket'), // After success, response data will be named into `json`, and store `json.data.captcha_ticket` into captcha_ticket as this line demands.
                    ]
                ],
                'Sms' => [
                    'url' => '/user/register/sms',
                    'data' => [
                        'phone' => RegExp::make('/^1[34578][\d]{9}$/'),           // UltDebugKit will generate a mokery data for you
                        'captcha' => '1234',                                      // Static string data
                        'captcha_ticket' => Store::get('captcha_ticket'),         // Previously saved data named captcha_ticket in the step of 'Captcha'
                    ],
                    'done' => [
                        Store::set('phone', 'param.phone'),
                        Store::set('sms_ticket', 'json.data.sms_ticket'),
                    ]
                ],
                'Submit Register' => [
                    'url' => '/user/register',
                    'data' => [
                        'phone' => Store::get('phone'),
                        'password' => RegExp::make('/^[\w]{16}$/'),
                        'code' => '1234',
                        'sms_ticket' => Store::get('sms_ticket'),
                    ],
                    'done' => [
                        Store::set('uid', 'json.data.user.id'),
                        Store::set('password', 'param.password'),                 // Save data from parameters of this step-request
                    ]
                ],
            ],
            'Login' => [
                'Captcha' => [
                    'url' => '/user/captcha',
                    'data' => [ ],
                    'done' => [ Store::set('captcha_ticket', 'json.data.captcha_ticket'), ] ],
                'Submit Login' => [
                    'url' => '/user/login',
                    'data' => [ 'username' => Store::get('phone'), 'password' => Store::get('password'), 'captcha' => '1234', 'captcha_ticket' => Store::get('captcha_ticket'), ],
                    'done' => [ Store::set('authorization', 'json.data.authorization'), ] ]
            ],
        ]
    ]);

    echo $debug->render();
}