Emacs minor mode to evaluate PHP code in the Boris PHP REPL
Emacs Lisp
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.org
php-boris-minor-mode.el

README.org

php-boris-minor-mode

Evaluate PHP code in the Boris PHP REPL

An Emacs minor mode that adds keyboard shortcuts to php-mode to send code from a PHP buffer to the Boris PHP REPL and evaluate it there.

Prerequisites

  • boris - PHP Read Eval Print Loop (REPL)

    https://github.com/d11wtq/Boris

    I had to comment this in php.ini for Boris to work:

    ; disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
        
  • php-boris - an Emacs extension for Boris

    From MELPA, install via M-x package-install

Installation

quelpa

quelpa is at https://github.com/quelpa/quelpa

(quelpa '(php-boris-minor-mode :fetcher github :repo "steckerhalter/php-boris-minor-mode"))

Since the recipe is stored in melpa this also works:

(quelpa 'php-boris-minor-mode)

Interactively: M-x quelpa php-boris-minor-mode RET.

MELPA

php-boris-minor-mode is on MELPA. First setup the package archive and then install the package: M-x package-list-packages, select php-boris-minor-mode from the list by pressing i, then press x to execute the changes.

El-Get Recipe

(:name php-boris-minor-mode
       :type git
       :url "https://github.com/steckerhalter/php-boris-minor-mode")

Manually

Load/evaluate the code and require php-boris-minor-mode.el

(with-temp-buffer
  (url-insert-file-contents "https://raw.github.com/steckerhalter/php-boris-minor-mode/master/php-boris-minor-mode.el")
  (eval-buffer))
(require 'php-boris-minor-mode)

Setup

Add the minor mode to the php-mode hook to enable it automatically:

(add-hook 'php-mode-hook 'php-boris-minor-mode)

Usage

Open a PHP buffer in Emacs and press C-c C-c on a line to send that to Boris. The REPL will pop up and you can see the result there. If a region is active it will send that to the REPL.

Available shortcuts:

Keyboard shortcutDescription
C-c C-cEvaluate either the current statement or the active region (do what I mean)
C-c C-kEvaluate the current buffer in the REPL
C-c C-rEvaluate the the active region
C-c C-zSwitch to the REPL buffer, opening a new REPL if none exists
C-M-xEvaluate the function at point