定制 drwcli/pattern 二次开发

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

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

drwcli/pattern

Composer 安装命令:

composer require drwcli/pattern

包简介

Drwcli Pattern Template

README 文档

README

Drwcli is a dependency-free toolkit for building CLI-only applications in PHP created by @walegbenga. This repository is a template you can use to create a new application that has a single dependency: drwcli/drwcli.

Why drwcli

The current trend in software development is basing your project on a big pile of unknowns. There is nothing wrong in using third party software, but if more than 80% of your application is out of your control, things can get messy. What usually happens is that you don't even know what packages you're depending on, when using the most popular frameworks.

It can be used for microservices, personal dev tools, bots and little fun things.

Getting Started

You'll need php-cli and Composer to get started.

Create a new project with:

composer create-project --prefer-dist drwcli/application myapp

Once the installation is finished, you can run drwcli it with:

cd myapp
./drwcli

This will show you the default app signature:

usage: ./drwcli help

The default help command that comes with drwcli (app/Command/Help/DefaultController.php) auto-generates a tree of available commands:

./drwcli help
Available Commands

help
└──test

The help test command, defined in app/Command/Help/TestController.php, shows an echo test of parameters:

./minicli help test user=gbenga name=value
Hello, gbenga!

Array
(
    [user] => gbenga
    [name] => value
)

The simplest app

The simplest drwcli script doesn't require using Command Controllers at all. You can delete the app folder and use registerCommand with an anonymous function, like this:

#!/usr/bin/php
<?php

if (php_sapi_name() !== 'cli') {
    exit;
}

require __DIR__ . '/vendor/autoload.php';

use \Drwcli\App;
use \Drwcli\Command\CommandCall;

$app = new App();
$app->setSignature('./drwcli mycommand');

$app->registerCommand('mycommand', function(CommandCall $input) {
    echo "My Command!";

    var_dump($input);
});

$app->runCommand($argv);

Created with Drwcli

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固