yahvya/php-cli-tool-builder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

yahvya/php-cli-tool-builder

Composer 安装命令:

composer require yahvya/php-cli-tool-builder

包简介

PHP library which helps to build cli php scripts

README 文档

README

A lightweight library to build your own custom CLI scripts.

📄 Library Details

  • 👤 Author and maintainer: Yahaya Bathily - GitHub
  • 📄 License: MIT
  • 🧾 License usage: Free to use in both commercial and non-commercial projects under the MIT license.
  • 🗓️ Created at: 25/08/2025

📚 Documentation

The steps to create your own scripts are as follows:

  • Create your command classes by implementing the CliCommand interface
  • Create the script file
  • Load your autoload file
  • Create an instance of the CliToolBuilder class with the expected configuration like bellow
  • Call the treat input method with the arguments of the script as a parameter (you can simulate your arguments by passing a formated array like $argv, 'command name' 'arguments...')
<?php

use Yahvya\PhpCliToolBuilder\Builder\CliToolBuilder;
use Yahvya\PhpCliToolBuilder\Builder\CliToolConfiguration;
use Yahvya\PhpCliToolBuilder\Default\Command\HelpCommand;

require_once(__DIR__ . "/vendor/autoload.php");

$cliToolBuilder = new CliToolBuilder(
    configuration: new CliToolConfiguration(
        toolName: "cli-lib",
        toolDescription: "A tool to help you build your cli tool",
        toolVersion: "1.0.0",
        toolAuthor: "Yahvya",
        commands: [
            new HelpCommand()
        ]
    )
);

try
{
    $cliToolBuilder->treatInput(cliArguments: $argv);
}
catch(Exception $e)
{
    echo $e->getMessage();
}

There are also some 'traits' available under the Yahvya\PhpCliToolBuilder\Power namespace that you can use to develop your commands quickly.

  • SearchArgumentPower : allows searching arguments in different ways

✅ Library Test Coverage

To run the tests, clone the repository and run:

php vendor/bin/phpunit

Code Coverage Report



Code Coverage Report:
  2025-08-25 20:06:29

 Summary:
  Classes: 66.67% (2/3)
  Methods: 60.00% (3/5)
  Lines:   59.46% (22/37)

Yahvya\PhpCliToolBuilder\Builder\CliToolBuilder
  Methods:  33.33% ( 1/ 3)   Lines:  53.12% ( 17/ 32)
Yahvya\PhpCliToolBuilder\Builder\CliToolConfiguration
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
Yahvya\PhpCliToolBuilder\Power\SearchArgumentPower
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  4/  4)

🙌 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

📫 Contact

If you have any questions or suggestions, feel free to reach out via GitHub.

yahvya/php-cli-tool-builder 适用场景与选型建议

yahvya/php-cli-tool-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 yahvya/php-cli-tool-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yahvya/php-cli-tool-builder 我们能提供哪些服务?
定制开发 / 二次开发

基于 yahvya/php-cli-tool-builder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-25