How to use psysh debugging code snippet tool for PHP

醉折花枝作酒筹
Release: 2023-03-11 07:00:01
forward
1706 people have browsed it

PsySH is a PHP runtime development platform, interactive debugger and Read-Eval-Print Loop (REPL). To put it simply, it's just like you use firebug's console to debug your JavaScript code. Next, the editor will introduce PsySH to you.

How to use psysh debugging code snippet tool for PHP

Official website

https://psysh.org/

Github address

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

Install

Use wget to install

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

Use composer to install

 $ composer g require psy/psysh:@stable
 $ psysh
Copy after login

Command

wtf Print Recent error prompts

history Display execution command

clear Clear command

doc Display function usage document

dump Print variable

ls Display variables

show Display function constants Class methods

When using the doc command, you need to install the file locally

PsySH documentation is stored in ~/.local/share/psysh/ . (The windows system is stored in C:\Users\{username}\AppData\Roaming\PsySH\)

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

Configuration

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

<?php
return [
    &#39;commands&#39; => [
        new \Psy\Command\ParseCommand,
    ],

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

    &#39;startupMessage&#39; => sprintf(&#39;<info>%s</info>&#39;, shell_exec(&#39;uptime&#39;)),
];
Copy after login
<img src=&#39;https://gitee.com/smallsha/upic/raw/master/uPic/下载 (2).png&#39; alt=&#39;下载(2)&#39; style="zoom:50%;" />
Copy after login

Recommended learning: php video tutorial

The above is the detailed content of How to use psysh debugging code snippet tool for PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!