PHP code example of phalapi / cli

1. Go to this page and download the library: Download phalapi/cli 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/ */

    

phalapi / cli example snippets



// 引入PhalApi初始化文件

$cli = new PhalApi\CLI\Lite();
$cli->response();

#!/usr/bin/env php

lApi\CLI\Lite {

    // 自定义帮助说明
    protected function getHelpText($text) {
        // 在原有的帮助说明,后面追加自己的文字  
        $context = "--- 自定义的帮助说明 ---" . PHP_EOL;
        
        return $text . PHP_EOL . $context;
    }
}

$cli = new MyCLI();
$cli->response();


class MyCLI extends PhalApi\CLI\Lite {

    // 提供接口列表,service -> 接口功能说明
    protected function getServiceList() {
        return array(
            1 => ['App.Hello.World', '演示接口'],
        );
    }
}