承接 crodas/cli 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

crodas/cli

最新稳定版本:v0.2.1

Composer 安装命令:

composer require crodas/cli

包简介

Simple and silly abstraction on top of symfony/console

README 文档

README

Simple and silly abstraction on top of symfony/console

How does it work?

The main goal is to give a generic and extensible way of registering console applications.

The application itself should like like this (cli.php).

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

$cli = new crodas\cli\Cli("/tmp/some.cache.tmp");
// the vendors cli
$cli->addDirectory(__DIR__ . '/vendor');
// add my APP directory
$cli->addDirectory(__DIR__ . '/apps');

// run
$cli->main();

Then inside apps/ we could have apps/cli/foobar.php and it should look like this:

<?php
namespace myApp\Cli;

/**
 * @Cli("foobar", "some text to describe my app")
 * @Arg('name', OPTIONAL, 'add name')
 * @Option('foobar', VALUE_REQUIRED|VALUE_IS_ARRAY, 'add name')
 */
function foobar_main($input, $output)
{
    $arg = $input->getArgument('name');
    $opt = $input->getOption('foobar');
    $output->writeLn(json_encode(compact('arg', 'opt')));
}

Now we can easily do php cli.php foobar, foobar_main function would be called.

Benefits

  1. Console applications are discovered
    • No autoloader needed
    • No conventions to follow
  2. It can use some cache function to avoid scanning lots of directories and files everytime.
  3. Annotations :-)
  4. Plugins support
    1. @One or @Crontab make sure your command runs just once

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-4-Clause
  • 更新时间: 2013-11-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固