
Boris: A tiny but robust REPL for PHP - nodesocket
https://github.com/d11wtq/boris
======
RobAley
That looks good, although one may wonder at the long term support prospects
(the author says "I'm in the process of transitioning away from PHP to
Ruby.").

For your delectation, other PHP repls include :

\- The basic built-in repl "php -a"

\- Facebooks phpsh : <http://phpsh.org/>

\- PHP Shell : <http://jan.kneschke.de/projects/php-shell>

\- php-repl : <https://github.com/tailrecursion/wigwam>

If you want something more customised to your needs, investigate the plethora
of readln and posix functions in PHP and dive right in!

~~~
d11wtq
That is a fair concern to have, though I will be working on and maintaining
Boris for the foreseeable future (already have a bunch of features planned, to
make it more extensible).

As with Swift Mailer, which I maintained for many years, if the time comes for
somebody else to take the project over, Boris will live on under a new
maintainer. That's very unlikely in the next couple of years though. Plenty of
activity via pull requests now.

------
martinml
To those who, like me, thought _PHP already has this_ :

> PHP's interactive mode does not print the result of evaluating expressions
> and more importantly, it exits if you type something that produces a fatal
> error, such as invoking a function/method that does not exist, or an
> uncaught exception. Boris is designed to be robust, like other REPLs, so you
> can experiment with things that you know may error, without losing
> everything.

~~~
gingerlime
I was wondering the exact same thing. Sounds cool.

Anybody knows of a debugger equivalent to ipdb (python) / pry (ruby) for php
to allow live debugging stuff on the server?

~~~
itry
You can live-debug with xdebug. Have been using it with vim and it worked.

~~~
MrUnderhill
Seconded. xdebug and the vim plugin "vdebug" (
<https://github.com/joonty/vdebug> ) work like a charm.

------
apinstein
REPL's in PHP are quite hard due to the fatal error issue, among other things.

I wrote one (<https://github.com/apinstein/iphp>) a long time ago that got
around a lot of these issues using temporary files, but his idea to use
forking is really neat. I never got multi-line input working, either. I have
been thinking about re-doing it with runkit, but now I'll have to play around
with BORIS and see how it works.

------
ejrowley
Very useful tool, partially useful is being able to start a Boris shell mid
script:

$boris = new \Boris\Boris('myapp> ');

$boris->setLocal(array('appContext' => $appContext));

$boris->start();

so that you can poke about.

------
M4v3R
Does it mean that now full PHP support could be added to Light Table?

------
soulclap
"There's no chance it can work on Windows, due to the dependency on POSIX
features". Too bad.

~~~
glurgh
PHP and Windows are often enough at odds that not having a nice REPL is
probably going to be the least of your problems. The other poster is right,
bring up a VM and be happy.

~~~
dragonmantank
Huh? PHP and IIS work perfectly fine together. MS has worked really hard to
make PHP a first-class language on their OS. PHP 5.3 and IIS 7.5+ are dead
simple to get working. Azure features PHP support as one of their main
features.

I've even got a client on an ancient Windows 2000 box running PHP. Took all of
an hour to get running. Yes, not the most preferred stack, but they aren't at
odds.

~~~
jiggy2011
If you are using IIS/PHP how interchangeable is that with LAMP? In other words
if I develop locally using IIS/Windows can I just drop the same code onto a
LAMP server without breaking anything?

~~~
jtreminio
There are a few functions that are not available on Windows.

If you hard-code paths in the code that refer to Linux-specific things, it
won't work in Windows.

That said, if it works on Windows, it will most likely work on Linux, but a VM
should still be favored due to the probability of prod being Linux.

------
tangue
Interesting. Even if most of PHP core devs are stuck in another era, the
community manages to keep the boat afloat.

~~~
Udo
What is that other era like, exactly?

Edit: it was an honest question. You casually threw that statement about
living in another era out there and get upvoted for it, while I'm being
punished for asking you to elaborate on what you actually mean. Is that the
PHP hate brigade at work or was there some kind of misunderstanding?

~~~
skore
Very pleasant, actually, as long as you get used to people telling you that
you're living in another era.

~~~
drivingmenuts
Perl programmers were in another era before you.

Perl - for original hipsters.

~~~
skore
Perl - one of the few programming languages that PHP developers are allowed
and encouraged to feel smugly superior over.

------
noptic
Looks great now I can dump my 60 lines of tape, shoe strings and "I do not
have time for this" and use a serious tool.

Thank you.

------
scribu
I looked at it a while ago and it seemed abandoned.

Going to take a stab at using it in WP-CLI: <https://github.com/wp-cli/wp-
cli/pull/437>

------
mikelbring
Laravel 4 [1] has something called Tinker built in, that lets you interact
with your application in a REPL environment.

[1] <http://four.laravel.com/>

~~~
deweller
I can't find anything named tinker in the latest laravel source. Where did you
find it?

~~~
soulclap
I can't find any documentation and haven't tested it yet but here's a class
for a 'tinker' command in the Illuminate (Laravel) sources:
[https://github.com/laravel/framework/blob/master/src/Illumin...](https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Console/TinkerCommand.php)

'php artisan tinker' on the command line should bring it up.

------
duhastmich
I wrote this shell script to evaluate php expressions directly inside
vim(<https://github.com/zweifisch/pipe2eval>).

------
pwr
I'm using phpsh as a REPL for PHP: <https://github.com/facebook/phpsh>

Are there any benefits in switching to BORIS for me?

------
kijin
Brilliant! This seriously needs to be in PHP core.

------
drorweiss
Looks useful! What does the name BORIS stand for? I see the creator is called
Chris...

~~~
bbenko
Maybe the author is a fan. The Wire - "Why always Boris..."
<http://www.youtube.com/watch?v=JyHuG1ks04A>

------
ing33k
cool, will be useful to sharpen my php skills.

