PHP如何使用psysh调试代码片段工具

来自:互联网
时间:2021-07-01
阅读:

官方网址

https://psysh.org/

Github地址

https://github.com/bobthecow/...

安装

使用wget安装

$ wget https://git.io/psysh
$ chmod +x psysh
$ ./psysh

使用composer安装

 $ composer g require psy/psysh:@stable
 $ psysh

Command

wtf 打印最近的错误提示

history 显示执行命令

clear 清除命令

doc 显示函数使用文档

dump 打印变量

ls 显示变量

show 显示函数 常量 类 方法

doc命令使用的时候需要安装文件到本地

PsySH的文档存放在~/.local/share/psysh/。(Windows系统存放在C:\Users\{用户名}\AppData\Roaming\PsySH\)

$ cd ~/.local/share 
$ mkdir psysh
$ cd psydh
$ wget http://psysh.org/manual/zh/php_manual.sqlite

Configuration

Osx ~/.config/psysh/config.php (or C:\Users\{USER}\AppData\Roaming\PsySH\config.php on Windows).

<?php
return [
    'commands' => [
        new \Psy\Command\ParseCommand,
    ],

    'defaultIncludes' => [
        __DIR__ . '/include/bootstrap.php', //这里可以加载自己平时常用的类库
    ],

    'startupMessage' => sprintf('<info>%s</info>', shell_exec('uptime')),
];
<img src='https://gitee.com/smallsha/upic/raw/master/uPic/下载 (2).png' alt='下载(2)' style="zoom:50%;" />
返回顶部
顶部