php-scratch is a scratch buffer for emacs to interactively evaluate php code.
php-scratch is available as a MELPA package: M-x package-install
[RET] php-scratch
[RET]
php-scratch depends on the Boris PHP REPL.
The php-scratch-boris-command
variable has to be set to the path of the boris command. The default value is "boris"
.
-
Open the php scratch buffer with the following command: M-x
php-scratch
-
You can evaluate php code in the scratch buffer by marking a region and pressing C-c C-e. If there is no active region, the current line will be evaluated. The evaluation result will be shown in the minibuffer.
-
You can also evaluate php code from the minibuffer by pressing C-c M-:.
-
To clear the state of the evaluated code (f.ex. variables and function declarations), you can press C-c C-c.