承接 clippy/std 相关项目开发

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

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

clippy/std

最新稳定版本:v0.5.1

Composer 安装命令:

composer require clippy/std

包简介

TODO

README 文档

README

Clippy is a CLI framework for scripting in PHP -- i.e. creating short, task-specific, standalone commands. It is heavily based on mnapoli/silly.

Scripting is a different domain than, say, full business applications.

  • In some ways, scripting is more modest: a full business application may have a wide variety of entities, screens, commands, and authors. Dependencies and conventions among these various components must be reconciled. By contrast, a script is generally focused on smaller tasks and has wider latitude to mix and match libraries and conventions.
  • In other ways, scripting is more stringent: the naming/structure/metadata should be quite thin to allow quick improvisation, and it should be easy+safely to frequently call out to other CLI commands. By contrast, a full business app has more value built-in -- so it needs more structure to differentiate its internal components, and it doesn't need to call-out as frequently.

Note: To simplify the workflows for dependency management, the examples use pogo. pogo should be installed in the PATH. Alternatively, you can rework the examples - instead, create a new composer package for each script and run composer require <package>:<version> has needed.

Example

#!/usr/bin/env pogo
<?php
#!require clippy/std: ~0.2.0
namespace Clippy;

$c = clippy()->register(plugins());
$c['app']->main('yourName [--lang=]', function ($yourName, $lang, $io) {
  $messages = [
    'de' => "Hallo, <comment>$yourName</comment>!",
    'en' => "Hello, <comment>$yourName</comment>!",
    'es' => "!Hola <comment>$yourName</comment>!",
    'fr' => "Salut, <comment>$yourName</comment>!",
  ];
  $io->writeln($messages[$lang] ?? $messages['en']);
});

Which one would execute as

$ ./greeter.php world
Hello, world!
$ ./greeter.php Alice --lang=fr
Salut, Alice!

For more discussion and improvement of the example, see docs/tutorial.md.

Documenation:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-08