定制 liberty_code/command 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

liberty_code/command

最新稳定版本:v1.0.1

Composer 安装命令:

composer require liberty_code/command

包简介

Library

README 文档

README

Description

Library contains command line components, to use features and other libraries components, on command line context.

Requirement

  • Script language: PHP: version 7 || 8

Installation

Several ways are possible:

Composer

  1. Requirement

    It requires composer installation. For more information: https://getcomposer.org

  2. Command: Move in project root path

     cd "<project_root_path>"
    
  3. Command: Installation

     php composer.phar require liberty_code/command ["<version>"]
    
  4. Note

    • Include vendor

      If project uses composer, vendor must be included:

        require_once('<project_root_path>/vendor/autoload.php');
      
    • Configuration

      Installation command allows to add, on composer file "/composer.json", following configuration:

        {
            "require": {
                "liberty_code/command": "<version>"
            }
        }
      

Include

  1. Download

    • Download following repository.
    • Put it on repository root path.
  2. Include source

     require_once('<repository_root_path>/include/Include.php');
    

Configuration

Main configuration

  • Use following class to configure specific elements

      use liberty_code\command\config\model\DefaultConfig;
      DefaultConfig::instanceGetDefault()->get|set...();
    
  • Elements configurables

    • Request options

Usage

Route

Route allows to interpret specified source, from command line request, on command line context, to get executable.

Elements

  • CommandPatternRoute, CommandParamRoute, CommandFixRoute, CommandSeparatorRoute

    Extends route features. Adapt all standard routes, to interpret specified source, from command line request, and get information (summary and help).

  • CommandRouteFactory

    Extends DI route factory features. Provides command route instance.

Request

Request allows to provide route source, on request flow process and command line context.

Elements

  • CommandRequest

    Extends request features. Allows to design command line request.

Example

use liberty_code\command\request_flow\request\model\CommandRequest;
$request = CommandRequest::instanceGetDefault();
echo($request->getStrRouteSrc()); 
// Show "{route:<route>,argument:[<command line arguments...>],option:[<command line options...>]}"
...

Response

Response allows to provide final send-able content, from request flow process, on command line context.

Elements

  • Response utilities

    Information command line response allows to get specific information about context, on command line context.

      Example: response with command lines summary content, 
      response with specific command line help content.
    

Front controller

Front controller allows to design the request flow process, on command line context.

Elements

  • CommandFrontController

    Extends front controller features. Uses command line request, to get response.

  • InfoFrontController

    Extends command line front controller features. Allows to manage information command line responses.

Example

use liberty_code\command\request_flow\front\model\CommandFrontController;
$frontController = new CommandFrontController();
$frontController->setRouter(...);
$frontController->setActiveRequest(...);
...
// Show response object
var_dump($frontController->execute());
...

Authentication

Authentication allows to design an authentication class, using command request arguments.

Elements

  • CommandAuthentication

    Extends authentication features. Uses command request arguments, to get all identification and authentication information.

Example

// Get command authentication
use liberty_code\command\request_flow\request\model\CommandRequest;
$commandAuth = new CommandRequest($request);
$commandAuth->setAuthConfig(...);
...
// Get array of identification data
var_dump($commandAuth->getTabIdData());
...
// Get array of authentication data
var_dump($commandAuth->getTabAuthData());
...

统计信息

  • 总下载量: 885
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-04-09