Blog RSS Feed Subscribe

Jordi Boggiano

Jordi Boggiano Passionate web developer, specialized in web performance and php. Partner at Nelmio, information junkie and speaker.

Categories

PHP Console in Your Browser

So-called interactive modes for scripting languages are commonly used in the command line, and they are great for quick tests, but most of the time when I try something it tends to grow and quickly becomes painful to handle in a CLI one-liner.

Since I spend most of my days programming PHP I tend to need that a lot and a few years back I wrote a small script that would let me type php code in my browser and execute it. Nothing fancy, but quite useful.

Over the years a few people got interest seeing me use it and asked for the sources, so instead of repackaging it every time, I thought I'd clean it up, polish a bit, add some features, and put it on github.

I can't really let you try it on my website for the obvious security implications, but you can look at the screenshot below or to get your hands on it more directly head to github (seldaek/php-console) or grab the zip archive.

Setup is easy, just put it somewhere, and run it in a browser. It only works from localhost, so it's as secure as your machine is, and I can't be held responsible for anything.

It fetches the execution result with javascript so you can even die() in the script with no problem, and expands tabs to spaces. Press ctrl-enter to submit from the textarea.

What do you think?

September 23, 2010 // PHP

Post a comment:


Formatting: you may use [code php] [/code] (or other languages) for code blocks, links are automatically linked. <strong>, <em> and <blockquote> html tags are allowed without nesting, the rest will be escaped.

Subscribe to this RSS Feed Comments

2010-09-23 18:50:03

NoSalt

This is friggin' awesome!!! Thanks!

2010-09-24 15:00:03

Angelo

Good idea! I will use it... thanks

2010-09-24 16:43:50

raveren

Frigging great! You could improve it with codemirror, that'd be totally awesome:
http://codemirror.net/contrib/php/index.html

2010-09-24 17:18:08

Richard

Thanks -- forked!

2010-09-25 10:40:07

Seldaek

@raveren: Thanks for the hint, I'll have a look, but it might mess with my tab expansion code and I'd rather have that than syntax highlighting for small bits of code, so we will see how it turns out.

2010-10-16 23:14:51

Kaloyan K. Tsvetkov

Hi Jordi,

I am the developer of Krumo, and I really like what's you've done with it ;) I am really sorry that I do not have time for it and pretty much the Krumo development has frozen since late 2007. Anyway, cool projects like your make me happy that Krumo is indeed helpful, and not just a funky lib :P

2010-10-19 08:24:07

Silvan Mühlemann

Great tool, Jordi, Thanks. Finally don't need the bash based "php -r 'echo foo();'" stuff...

2010-10-19 18:02:01

Seldaek

@Silvan: Especially since that quickly turns into an escaping hell with $'s and single/double quotes. @Kaloyan: Glad you like it, and thanks for the lib, it's simple and old but it does what it needs to do imo, and that's what matters.

2011-08-10 05:34:50

Simon

Just discovered this... Very cool!

2013-05-25 17:20:21

Tomek

Thank You :)

2013-05-29 19:44:13

Syed Afzal Hussain

This is very nice and simple. Thanks :)

2013-10-06 20:38:18

Jorge

This is super work Jordi, thanks for putting it up here!

2014-05-30 20:09:22

Paul

This is great - exactly what I was looking for. I've been using online ones but it's nicer to have it on my own server as I know what I enter and test is private. Thank you! :)