Skip to content
PsySH on Emacs, PHP interactive shell (REPL)
Emacs Lisp
Branch: master
Clone or download
Latest commit 2125098 Jul 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Cask Bump version 0.0.5 Nov 28, 2018
README.org Update README Jul 11, 2016
composer.json Add Cask and composer.json Feb 7, 2017
psysh.el

README.org

PsySH.el

MELPA

PsySH, PHP interactive shell (REPL)

Compatibility

Installation

A: The easy way

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

And copy or make symlink to your $PATH dir.

B: The other easy way

Get Composer. See https://getcomposer.org/download/

$ composer g require psy/psysh:@stable

C: Project local REPL

Set psysh-comint-buffer-process (buffer local variable).

(setq psysh-comint-buffer-process "path/to/shell.php")

shell.php is for example:

#!/usr/bin/env php
<?php
// ↓Namespace for your project
namespace Nyaan;

// load Composer autoload file
require_once __DIR__ . '/vendor/autoload.php';
// load other initialize PHP files
// require_once …

echo __NAMESPACE__ . " shell\n";

$sh = new \Psy\Shell();

// Set project namespace in REPL
if (defined('__NAMESPACE__') && __NAMESPACE__ !== '') {
    $sh->addCode(sprintf("namespace %s;", __NAMESPACE__));
}

$sh->run();

// Termination message
echo "Bye.\n";

See also http://cho-phper.hateblo.jp/entry/2015/11/10/031000 (Japanese)

You can’t perform that action at this time.