Coderoncode

Random ramblings about code, programming and technology

Books


Social Media


Lead Developer @ Demac Media


© 2014. Allan MacGregor All rights reserved.

Boris The Missing PHP REPL

REPL(read-eval-print loop) can be great tools for quickly testing concepts, experimenting and getting quick feedback when learning a new language. Many languages and frameworks provide some sort of REPL like the rails console or laravel's artisan tinker.

PHP by itself has the interactive shell that can be invoked with:

php -a 

However the PHP Interactive Shell lacks several features that other modern languages have in their REPL's; like proper error handling, multi-line support and result output by default.

Meet Boris

Python has one. Ruby has one. Clojure has one. Now PHP has one too. Boris is PHP's missing REPL (read-eval-print loop), allowing developers to experiment with PHP code in the terminal in an interactive manner. If you make a mistake, it doesn't matter, Boris will report the error and stand to attention for further input.

Boris, was developed by Chris Corbyn a PHP developer that after making the transition to Ruby was disappointed by the lack of a true PHP REPL.

After playing around with Boris for while, I can honestly say that it has the right to call itself 'The Missing PHP REPL'; not only provides the basic features that you would expect from a standard REPL but also:

On top of that Boris can be easily installed or included in any project using composer.

All these features make Boris a powerful and flexible tool regardless if you are just using it to test quick snippets or as part of a large application.

Word count: 253

Enjoyed the article? Follow me on Twitter or with RSS.

comments powered by Disqus