daspors/shellphp
Composer 安装命令:
composer require daspors/shellphp
包简介
PHP command line tools
README 文档
README
ShellPHP helps you bring the power and ease of installation of PHP to the command line.
It is meant to provide a toolbox for developers that waht or need to develop programs in PHP that
will run in bash, not in WebServer environment.
Feature overview
- Commandline argument handling
- Process management
- High level (Sqlite-based) data storage
- WebInterface (experimental)
\ShellPHP\CmdLine
The commandline handler makes it easy to define flags, options and arguments and even provides the ability to create commands that split your application into logical parts (like apt-get and many others do).
$cli = \ShellPHP\CmdLine\CmdLine::Make("ShellPHP Test Script","Version 0.0.0.2") ->command('list') ->opt('-f','none')->map('filter') ->arrayArg('folder') ->handler(function($args) { extract($args); var_dump($args); var_dump(get_defined_vars()); echo "\n --> $filter $folder\n\n"; }) ->end() ->command('add') ->opt('-p')->map('path')->text('Local folder to add') ->handler(function($args) { extract($args); echo "Add --> $path\n\n"; }) ->end(); $cli->command('remove')->opt('-f'); $cli->go();
\ShellPHP\Process
This is a class that helps you enumerate, find and run processes.
\ShellPHP\Storage
Really powerful yet easy to use Storage. Every application needs to store some data somewhere every now and them.
The Storage class provides a high level interface so that in most cases you wont need to perform any SQL queries.
class MyModel extends \ShellPHP\Storage\StoredObject { public $id = 'int primary autoinc'; public $name = 'text unique'; public $desc = 'text'; } \ShellPHP\Storage\Storage::Make('my_app_database.sqlite'); $obj1 = MyModel::Make(array('name'=>'obj1')); $obj1->Save(); MyModel::Make()->set('name','obj2')->Save(); var_dump(MyModel::Select()->like('name','obj%')->results()); $obj1->Delete(); var_dump(MyModel::Select()->results());
\ShellPHP\WebInterface
There's a currently experimental feature to provide you with a webinterface.
$webinterface = \ShellPHP\WebInterface\WebInterface::Make() ->index(__DIR__."/web") ->handler('list',function($request){ return \ShellPHP\WebInterface\WebResponse::Json(array('hello'=>'world')); } ) ->go();
daspors/shellphp 适用场景与选型建议
daspors/shellphp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「arguments」 「stdout」 「stdin」 「argv」 「args」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 daspors/shellphp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daspors/shellphp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 daspors/shellphp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii log route for streams
Finally a sane way to register available commands and arguments and match your command line in PHP.
Full featured package for managing command-line applications.
CLI tooling with zero configuration required.
Process is a PHP library to help with the task of running other applications asynchronously from PHP in a pseudo-threaded way.
Gestionnaire (handler) d'envoi de message en couleur sur la sortie standard (stdout) pour Monolog.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: WTFPL
- 更新时间: 2020-04-29