So, I decided to spend a little time improving my PHP skills. I’ve been building hacking wordpress templates and building plugins for a while, but I’ve been feeling like I need to improve my mastery of object-oriented development in PHP. I picked up a copy of William Sanders “Learning PHP Design Patterns” and started working through it. As I began working with the examples, I felt the urge to test concepts really quickly. Having a REPL handy is basic necessity for testing things out quickly in any language. Getting a REPL to run inside emacs makes driving your REPL of choice even faster and a great deal more pleasurable. My php repl of choice is boris, simply because I’ve got some familiarity with it. To get it to run inside emacs I installed php-boris and php-boris-minor-mode. php-boris needs the highlight library. My config ended up looking like this:

;; boris

(require ‘highlight)

(add-to-list ‘load-path (expand-file-name “~/.emacs.d/lisp/php-boris”))
(require ‘php-boris)

(add-to-list ‘load-path “~/.emacs.d/lisp/php-boris-minor-mode”)

(require ‘php-boris-minor-mode)
(add-hook ‘php-mode-hook ‘php-boris-minor-mode)
(add-hook ‘web-mode-hook ‘php-boris-minor-mode)

Once all the libraries were installed, I evaluated my conf file and ran a test: I created a simple php file and passed it to boris. It worked!

Another pane opened in my emacs window, showing PHP’s evaluation of my test.


Putting the pieces together was easy enough. Now I can quickly test ideas from within emacs.