Boris: A tiny but robust REPL for PHP
github.com
github.com
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!
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.
> 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.
Anybody knows of a debugger equivalent to ipdb (python) / pry (ruby) for php to allow live debugging stuff on the server?
In a similar vein to @gingerlime, anyone know a PHP mode for IPython [2]? It'd be great to prototype my code in a notebook.
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.
$boris = new \Boris\Boris('myapp> ');
$boris->setLocal(array('appContext' => $appContext));
$boris->start();
so that you can poke about.
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.
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.
In my opinion, Unix is much nicer than BeOS. Also, BeOS uses C++, and not all programming languages work nicely with OO. In contrast it is easy to use all languages with C.
Also, why don't you complain when someone makes a program that only works for Windows? There percentage of Unix-only programs is really small compared to number of Windows-only programs.
POSIX only offers support for command line stuff and daemons. There isn't any GUI POSIX standard, so you only get half-way portability anyway.
Plus anyone with commercial UNIX experience knows that POSIX is like HTML, just because the standard is supported, it does not mean it works the same everywhere.
> Portability takes a lot of work, which could've been used to improve the program, instead of trying to get stuff to work with the crappy Windows API. We need less fragmentation, not more. I would hate to write separate programs for Windows, BeOS/Haiku/Mac and *nix.
Welcome to the 80-90's.
> In my opinion, Unix is much nicer than BeOS. Also, BeOS uses C++, and not all programming languages work nicely with OO.
This is becoming a niche with major OS and compiler vendors slowly focusing on C++.
> In contrast it is easy to use all languages with C.
If the OS has a C ABI, yes.
> Also, why don't you complain when someone makes a program that only works for Windows? There percentage of Unix-only programs is really small compared to number of Windows-only programs.
Because I use computers since 1986 and UNIX used to be just one among many OSs. I only cared about it somewhere around 1994, after an history of several home systems.
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?
Perl - for original hipsters.
Thank you.
Going to take a stab at using it in WP-CLI: https://github.com/wp-cli/wp-cli/pull/437
'php artisan tinker' on the command line should bring it up.
Are there any benefits in switching to BORIS for me?