8 ms·
Boris: A tiny but robust REPL for PHP
- drorweiss 13y agoLooks useful! What does the name BORIS stand for? I see the creator is called Chris...
- kijin 13y agoBrilliant! This seriously needs to be in PHP core.
- martinml 13y agoTo 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 13y agoI 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 13y agoYou can live-debug with xdebug. Have been using it with vim and it worked.
- gingerlime 13y agoI'll take a look. Thanks.
- MrUnderhill 13y agoSeconded. xdebug and the vim plugin "vdebug" ( https://github.com/joonty/vdebug https://github.com/joonty/vdebug ) work like a charm.
- porker 13y agoIt looks like a great replacement for Facebook's unmaintained phpsh [1] (written ironically in Python). 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. 1. http://phpsh.org/ http://phpsh.org/ 2. http://ipython.org/ http://ipython.org/
- soulclap 13y ago"There's no chance it can work on Windows, due to the dependency on POSIX features". Too bad.
- noptic 13y agojust get a VM running linux. If you are to lazy to set up PHP get a pre build stack at http://bitnami.com/stack/lamp http://bitnami.com/stack/lamp
- glurgh 13y agoPHP 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 13y agoHuh? 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 13y agoIf 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 13y agoThere 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.
- M4v3R 13y agoDoes it mean that now full PHP support could be added to Light Table?
- noptic 13y agoLooks 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.
- pwr 13y agoI'm using phpsh as a REPL for PHP: https://github.com/facebook/phpsh https://github.com/facebook/phpsh Are there any benefits in switching to BORIS for me?
- RobAley 13y agoThat 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/ http://phpsh.org/ - PHP Shell : http://jan.kneschke.de/projects/php-shell http://jan.kneschke.de/projects/php-shell - php-repl : https://github.com/tailrecursion/wigwam 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!
- rustc 13y agoI was having several issues with phpsh (and it looks like it hasn't been updated for 2 years now - https://github.com/facebook/phpsh https://github.com/facebook/phpsh). Just tried Boris and it seems to be working good!
- d11wtq 13y agoThat 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.
- tangue 13y agoInteresting. Even if most of PHP core devs are stuck in another era, the community manages to keep the boat afloat.
- Udo 13y agoWhat 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 13y agoVery pleasant, actually, as long as you get used to people telling you that you're living in another era.
- drivingmenuts 13y agoPerl programmers were in another era before you. Perl - for original hipsters.
- skore 13y agoPerl - one of the few programming languages that PHP developers are allowed and encouraged to feel smugly superior over.
- tangue 13y agoIf you read php internals newsletter there is a sense amongst some of PHP core devs that PHP is "good enough", and those devs are against most innovations, and the fact that nobody knows who can vote in RFC[1] gives them an incredible power. [1] http://comments.gmane.org/gmane.comp.php.devel/79314 http://comments.gmane.org/gmane.comp.php.devel/79314
- Udo 13y ago
- ejrowley 13y agoVery 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.
- scribu 13y agoI 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 https://github.com/wp-cli/wp-cli/pull/437
- apinstein 13y agoREPL's in PHP are quite hard due to the fatal error issue, among other things. I wrote one (https://github.com/apinstein/iphp 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.
- ing33k 13y agocool, will be useful to sharpen my php skills.
- mikelbring 13y agoLaravel 4 [1] has something called Tinker built in, that lets you interact with your application in a REPL environment. [1] http://four.laravel.com/ http://four.laravel.com/
- deweller 13y agoI can't find anything named tinker in the latest laravel source. Where did you find it?
- soulclap 13y agoI 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/Illuminate/Foundation/Console/TinkerCommand.php https://github.com/laravel/framework/blob/master/src/Illumin... 'php artisan tinker' on the command line should bring it up.
- deleted 13y ago[deleted]
- davejamesmiller 13y agoTinker is a very basic REPL - it has no readline support or error handling - so I've just made a package to add Boris support to Laravel 4. https://github.com/davejamesmiller/laravel-boris https://github.com/davejamesmiller/laravel-boris
- nice1 13y agoThe subject of PHP reminds me of this (possibly untrue) story: a guy is whacking his own manhood with a hammer and someone asks him: "Why are you doing this?", to which he replies "For pleasure". When the other guy continues asking "But when do you feel the pleasure?" the first guy says "When I stop".
- duhastmich 13y agoI wrote this shell script to evaluate php expressions directly inside vim(https://github.com/zweifisch/pipe2eval https://github.com/zweifisch/pipe2eval).