定制 00f100/fcphp-command 二次开发

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

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

00f100/fcphp-command

Composer 安装命令:

composer require 00f100/fcphp-command

包简介

Library to manipulate console commands into FcPhp

README 文档

README

Package to manupulate commands of terminal into FcPhp

Build Status codecov

PHP Version Packagist Version Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-command

or add in composer.json

{
    "require": {
        "00f100/fcphp-command": "*"
    }
}

How to use

This package use FcPhp Security Console to manipulate permissions and FcPhp Cache to save commands cache for better performance

use FcPhp\SConsole\SCEntity;
use FcPhp\Command\Interfaces\ICEntity;
use FcPhp\Command\Facades\CommandFacade;


// Instance of SCEntity provider from FcPhp Security Console
// or ...
$entity = new SCEntity();

// Custom commands...
$commands = [];

// Composer dir to autoload find "commands.php" into packages and cache into FcPhp Cache
$vendorPathAutoload = 'vendor/*/*/config';

$instance = CommandFacade::getInstance($entity, $commands, $vendorPathAutoload);

// Args from console request
// Example: php index.php package datasource connect -h localhost -u user -p password
$args = [
    'package',
    'datasource',
    'connect',
    '-h',
    'localhost',
    '-u',
    'user',
    '-p',
    'password'
];

// Return instance FcPhp\Command\Interfaces\ICEntity
$match = $this->instance->match($args);

if($match instanceof ICEntity) {
    // Print status code
    echo $match->getStatusCode();

    // Print action
    echo $match->getAction();

    // ...
}

FcPhp\Command\Interfaces\ICEntity

<?php

namespace FcPhp\Command\Interfaces
{
    interface ICEntity
    {
        /**
         * Method to contruct instance
         *
         * @param array $params Params to entity
         * @return void
         */
        public function __construct(array $params = []);

        /**
         * Method to get command
         *
         * @return string|null
         */
        public function getCommand();

        /**
         * Method to get action
         *
         * @return string|null
         */
        public function getAction();

        /**
         * Method to get rule
         *
         * @return string|null
         */
        public function getRule();

        /**
         * Method to get params to controller
         *
         * @return array
         */
        public function getParams() :array;

        /**
         * Method to get status code
         *
         * @return int
         */
        public function getStatusCode() :int;

        /**
         * Method to get status message
         *
         * @return string|null
         */
        public function getStatusMessage();
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-08-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固