leearvin/hyperf-tinker
Composer 安装命令:
composer require leearvin/hyperf-tinker
包简介
Powerful REPL for the Hyperf framework.
README 文档
README
说明
install
composer require leearvin/hyperf-tinker
publish config
php bin/hyperf.php vendor:publish leearvin/hyperf-tinker
use
php bin/hyperf.php tinker
commnads
- run command
Psy Shell v0.10.4 (PHP 7.3.11 — cli) >>> $a=1 => 1 >>> $a => 1 >>> define('VERSION', 'v1.0.1') => true >>> VERSION => "v1.0.1" >>>
- The help command
>>> help help Show a list of commands. Type `help [foo]` for information about [foo]. Aliases: ? ls List local, instance or class variables, methods and constants. Aliases: dir dump Dump an object or primitive. doc Read the documentation for an object, class, constant, method or property. Aliases: rtfm, man show Show the code for an object, class, constant, method or property. wtf Show the backtrace of the most recent exception. Aliases: last-exception, wtf? whereami Show where you are in the code. throw-up Throw an exception or error out of the Psy Shell. timeit Profiles with a timer. trace Show the current call stack. buffer Show (or clear) the contents of the code input buffer. Aliases: buf clear Clear the Psy Shell screen. edit Open an external editor. Afterwards, get produced code in input buffer. sudo Evaluate PHP code, bypassing visibility restrictions. history Show the Psy Shell history. Aliases: hist exit End the current session and return to caller. Aliases: quit, q clear-compiled Remove the compiled class file down Put the application into maintenance mode env Display the current framework environment optimize Cache the framework bootstrap files up Bring the application out of maintenance mode migrate Run the database migrations inspire Display an inspiring quote
- get hyperf env
Psy Shell v0.10.4 (PHP 7.2.34 — cli) >>> env("APP_NAME") => "skeleton" >>>
- query db
➜ t.hyperf.com git:(master) ✗ php bin/hyperf.php tinker [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener. Psy Shell v0.10.4 (PHP 7.2.34 — cli) by Justin Hileman Unable to check for updates >>> $user = App\Model\User::find(1) [DEBUG] Event Hyperf\Database\Model\Events\Booting handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener. [DEBUG] Event Hyperf\Database\Model\Events\Booting handled by Hyperf\ModelListener\Listener\ModelEventListener listener. [DEBUG] Event Hyperf\Database\Model\Events\Booted handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener. [DEBUG] Event Hyperf\Database\Model\Events\Booted handled by Hyperf\ModelListener\Listener\ModelEventListener listener. [DEBUG] Event Hyperf\Database\Events\QueryExecuted handled by App\Listener\DbQueryExecutedListener listener. [DEBUG] Event Hyperf\Database\Model\Events\Retrieved handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener. [DEBUG] Event Hyperf\Database\Model\Events\Retrieved handled by Hyperf\ModelListener\Listener\ModelEventListener listener. => App\Model\User {#81816 +incrementing: true, +exists: true, +wasRecentlyCreated: false, +timestamps: true, } >>> var_dump($user) object(App\Model\User)#81816 (28) { ["table":protected]=> string(5) "users" ["fillable":protected]=> array(2) { [0]=> string(2) "id" [1]=> string(4) "name" } ["casts":protected]=> array(0) { } ["incrementing"]=> bool(true) ["exists"]=> bool(true) ["attributes":protected]=> array(4) { ["id"]=> int(1) ["name"]=> string(5) "arvin" ["created_at"]=> string(19) "2020-11-23 18:38:00" ["updated_at"]=> string(19) "2020-11-23 18:38:03" } ["original":protected]=> array(4) { ["id"]=> int(1) ["name"]=> string(5) "arvin" ["created_at"]=> string(19) "2020-11-23 18:38:00" ["updated_at"]=> string(19) "2020-11-23 18:38:03" } } => null
- show doc
>>> doc md5 function md5($str, $raw_output = unknown) PHP manual not found To document core PHP functionality, download the PHP reference manual: https://github.com/bobthecow/psysh/wiki/PHP-manual >>>
- show class
>>> show App\Model\User 7: /** 8: */ 9: class User extends Model 10: { 11: /** 12: * The table associated with the model. 13: * 14: * @var string 15: */ 16: protected $table = 'users'; 17: /** 18: * The attributes that are mass assignable. 19: * 20: * @var array 21: */ 22: protected $fillable = ['id','name']; 23: /** 24: * The attributes that should be cast to native types. 25: * 26: * @var array 27: */ 28: protected $casts = []; 29: } >>>
leearvin/hyperf-tinker 适用场景与选型建议
leearvin/hyperf-tinker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.62k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2020 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「swoole」 「Tinker」 「hyperf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 leearvin/hyperf-tinker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 leearvin/hyperf-tinker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 leearvin/hyperf-tinker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Tinker on vscode
annotations-scan-plugin
Tinker MCP tool for Laravel Boost — execute PHP code in the Laravel application context.
Fork BotMan tinker command for your Laravel BotMan project
SForum
Alfabank REST API integration
统计信息
- 总下载量: 6.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-13