fulore/psysh

现代PHP的交互式外壳。

dev-master / 0.1.0.x-dev 2013-10-07 02:43 UTC

This package is not auto-updated.

Last update: 2024-09-24 06:27:37 UTC


README

Build Status

在Presentate查看PHP交互式调试的OSCON演讲

安装

PsySH可通过Composer获得,或者您可以直接从本仓库使用。

git clone https://github.com/bobthecow/psysh.git
cd psysh
./bin/psysh

但到目前为止,最简单的方法是下载预编译的phar文件。

wget psysh.org/psysh
chmod +x psysh
./psysh

PsySH配置

尽管PsySH力求自动检测正确的设置,但您可能想自行配置。只需将文件添加到~/.psysh/rc.php

<?php

return array(
    // In PHP 5.4+, PsySH will default to your `cli.pager` ini setting. If this
    // is not set, it falls back to `less`. It is recommended that you set up
    // `cli.pager` in your `php.ini` with your preferred output pager.
    // 
    // If you are running PHP 5.3, or if you want to use a different pager only
    // for Psy shell sessions, you can override it here.
    'pager' => 'more',

    // By default, PsySH will use a 'forking' execution loop if pcntl is
    // installed. This is by far the best way to use it, but you can override
    // the default by explicitly enabling or disabling this functionality here.
    'usePcntl' => false,

    // PsySH uses readline if you have it installed, because interactive input
    // is pretty awful without it. But you can explicitly disable it if you hate
    // yourself or something.
    'useReadline' => false,

    // "Default includes" will be included once at the beginning of every PsySH
    // session. This is a good place to add autoloaders for your favorite
    // libraries.
    'defaultIncludes' => array(
        __DIR__.'/include/bootstrap.php',
    ),

    // While PsySH ships with a bunch of great commands, it's possible to add
    // your own for even more awesome. Any Psy command added here will be
    // available in your Psy shell sessions.
    'commands' => array(
        // The `parse` command is a command used in the development of PsySH.
        // Given a string of PHP code, it pretty-prints the
        // [PHP Parser](https://github.com/nikic/PHP-Parser) parse tree. It
        // prolly won't be super useful for most of you, but it's there if you
        // want to play :)
        new \Psy\Command\ParseCommand,
    ),
);

多字节字符串

在控制台显示的字符串是以未编码的形式显示的。

下载手册

PsySH的doc命令非常适合文档化源代码,但您需要一些额外的工具来处理PHP核心文档。下载以下PHP手册文件之一,并将其放入~/.psysh/