PHP Debug Console

Overview

PHP Console

A web console to try your PHP code into

Creating a test file or using php's interactive mode can be a bit cumbersome to try random php snippets. This allows you to run small bits of code easily right from your browser.

It is secure since accessible only from the local host, and very easy to setup and use.

Screenshot

PHP Console screenshot

Installation

Clone the git repo or download it as a zip/tarball, drop it somewhere in your local web document root and access it with http://localhost/path/to/php-console

You can also install it with Composer using this command:

composer create-project --stability=dev --keep-vcs seld/php-console

To update it just run git pull in the directory to pull the latest changes in.

You can use the internal PHP server too.
run php -S localhost:1337 in a terminal and go to http://localhost:1337/.

Configuration

Default settings are available in config.php.dist, if you would like to modify them, you can copy the file to config.php and edit settings.

Contributing

Code contributions or ideas are obviously much welcome. Send pull requests or issues on github.

Author

Jordi Boggiano - [email protected]
http://seld.be/ - http://twitter.com/seldaek

Changelog

  • 1.5.0-dev
    • Added melody-script integration. requires a composer binary within the systems/webservers PATH env variable.
    • Updated bundled ACE editor to 1.1.8
    • Layout is now flex-css based
    • Added a new bootstrap option to be include before source evaluation
    • Moved tabsize, ip-whitelist into an option
    • Added servers-side runtime information, to be rendered in the consoles statusbar
    • Allow configuring options
  • 1.4.0
    • Added control-char escaping to make them more visible
  • 1.3.0
    • Added code persistence across sessions in localStorage + a reset button
  • 1.2.3
    • Fixed syntax highlighting
    • Fixed some styling issues
    • Fixed ajax error handling for non responding backends
  • 1.2.2
    • Updated ACE to latest version
    • Added composer.json support
  • 1.2.1
    • Performance fixes for ACE editor integration
    • JS is no longer a requirement
  • 1.2.0
    • Replaced built-in editor with ACE editor which provides highlighting and other features
    • Handle old setups with magic_quotes enabled
  • 1.1.2
    • Fixed issue with IPv6 loopback not being whitelisted
  • 1.1.1
    • Cross-browser compatibility enhancements
  • 1.1.0
    • Script execution is now done via an async js request, preventing die() and exception to mess up the entire console
    • Added a status bar with char/line display
    • Added a toggle button to expand/collapse all krumo sub-trees at once
    • Cross-browser compatibility enhancements
    • Removing a tab (i.e. 4 spaces) on backspace now
    • Made tab character(s) configurable (see index.php)
  • 1.0.0
    • Initial Public Release

License

PHP Console is licensed under the New BSD License, which means you can do pretty much anything you want with it.

New BSD License - see the LICENSE file for details

Acknowledgements

PHP Console bundles the following libraries, and the work of their respective authors is very much appreciated:

  • krumo licensed under the LGPL
  • jQuery licensed under the MIT License
  • ACE licensed under the MPL/LGPL/GPL Licenses
  • Clippy licensed under the MIT License
Comments
  • Allow site to load if HTTP authentication is successful

    Allow site to load if HTTP authentication is successful

    I noticed how the user is redirected to an error message if the site is not launched from localhost. Perhaps we should provide a way to allow this site to be used on a remote server provided that it is in a directory requiring HTTP authentication?

    According to PHP's page on HTTP authentication, $_SERVER['REMOTE_USER'] should be set if external authentication (from a .htaccess file or what have you) was needed to reach the page and $_SERVER['PHP_AUTH_USER'] should be set if PHP's HTTP authentication methods were used.

    Let me know what you think...

    opened by enderandpeter 7
  • initial sensiolabs/melody integration

    initial sensiolabs/melody integration

    This PR integrates melody-scripts into the php-console.

    This means you can run melody scripts directly from your webbrowser. the melody integration makes sure all required composer dependencies are downloaded and available to the code within the console.

    On the first run (when dependencies are present which are not yet resolved) the php-console output panel will show what composer is doing in the background. melody-console-initial

    On any subsequent run (or run which only used already downloaded dependencies) the output looks like we are used to: melody-console-run

    //cc @lyrixx @jeremy-derusse

    opened by staabm 5
  • non-printable chars

    non-printable chars

    lately I am testing a lot of scripts which handle data, which contains non-printable chars.

    those lead to some weird output, because kumo says a string has 6 chars, but contains only 5 visible chars.

    contorl-chars

    I am not sure if this is something which should be handled at php-console level, but it makes debugging sometimes really hard. would be great to get a hint from php-console which tells me that there are some control-chars in the game.. (maybe they could be highlighted with css?)

    opened by staabm 5
  • Toggle widgets and behaviours

    Toggle widgets and behaviours

    This is a pull request for establishing a way to toggle some of the most prominent features of ACE, namely collapsing/expanding code blocks (widgets) and auto-pairing grouping characters (behaviours). I'm not sure why the changes from rlerdorf's commit are showing up as though they are new changes. I think the one difference in my version is that there is a newline at the end of the file. I can't say how that happened...

    The clickable boxes I made to toggle these features are just something to suggest how to go about setting up such an interface. Perhaps you'd prefer a different visual approach. I think it would be great to let the user invoke other features of the ACE editor as well, especially allowing them to choose a theme, but I think users would really appreciate turning just these features on and off. Please let me know what you think.

    opened by enderandpeter 5
  • Script ended unexpectedly.

    Script ended unexpectedly.

    Hi!

    I get a "Script ended unexpectedly" error when running the following code :

    $d = new DateTime();
    $i = new DateInterval('P2W');
    $p = new DatePeriod($d, $i, 5);
    
    < $p;
    

    php-console is running in the php 7 built-in web server (PHP 7.0.8-0ubuntu0.16.04.3).

    Am I doing something wrong ?

    opened by DavBE 4
  • Error on install

    Error on install

    I try to install only making download/clone e uncompress but not have vendor. I try to install with composer: composer create-project --stability=dev --keep-vcs seld/php-console Error: [InvalidArgumentException]
    Could not find package seld/phpconsole with stability dev.

    Then I down package zip, uncompress and cd /var/www/html/php-console composer update And works.

    Thank you for your work.

    opened by ribafs 4
  • Syntax highlighting not working after ACE update

    Syntax highlighting not working after ACE update

    Please see my comments in the last commit for this branch. Long story short, it would appear you'll have to use older ACE files for syntax highlighting with this project until we get to the bottom of the issue.

    I meant to have less commits associated with this pull request. I'm sure I'll get the hang of this...

    opened by enderandpeter 4
  • Fixed the error when using quotation marks

    Fixed the error when using quotation marks

    Hi

    This is awesome. I noticed there was an error when you use quotation marks.

    I changed the code from eval to write to a file and then execute the PHP in the new file.

    Dale

    opened by dalehurley 3
  • layout

    layout

    I just downloaded the latest git version and deployed it on my machine.

    I am wondering if it looks like it does by mistake or if this is the new style this tools is supposed to have.

    In case it is intended, you might update the screenshot in the readme.

    console

    opened by staabm 2
  • composer library support

    composer library support

    Sometimes you need to include/bootstrap a lib to run code within the debug console. e.g. you like to try if an API of a certain library achieves what you want..

    therefore it would be cool If I could somehow make a library which is distributed via composer/packagist available to the current source within phpconsole.

    I think about something like http://composer.borreli.com/, so having a separate tab in which I can drop a composer.json and have everything available defined in this file at your fingertips.

    opened by staabm 2
  • file handling

    file handling

    what do you think about adding support for opening/reading/writing files with the php-console via Gaufrette[1] attached resources?

    [1] https://github.com/KnpLabs/Gaufrette

    so, if configured... one could e.g. edit files on the server where php-console is deployed or use it to edit files of a remote server (using remote adapters etc..)

    opened by staabm 2
  • Vendor missing

    Vendor missing

    Hi!

    Maybe i am doing it wrong - but i get this error: "Missing vendor/autoload.php file. Did you forget to run "composer install" ?"

    I downloaded the zip file and did not use composer. The manual says it should be possible. What do i miss ?

    Thanks!

    opened by kingozorg 3
  • Melody script fails

    Melody script fails

    Running this PHP script in the console fails.

    ( ! ) Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\ProcessFailedException' with message 'The command "'[...]/php-console/composer.phar' 'config' '--global' 'vendor-dir' in [...]/php-console/vendor/symfony/process/Process.php on line 232 ( ! ) Symfony\Component\Process\Exception\ProcessFailedException: The command "'[...]/php-console/composer.phar' 'config' '--global' 'vendor-dir'" failed. Exit Code: 1(General error) Working directory: [...]/php-console Output: ================ Error Output: ================ [RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly in [...]/php-console/vendor/symfony/process/Process.php on line 232

    Call Stack
    #	Time	Memory	Function	Location
    1	0.0005	262600	{main}( )	.../index.php:0
    2	0.0050	603208	MelodyPlugin->runScript( )	.../index.php:104
    3	0.0056	633112	SensioLabs\Melody\Melody->__construct( )	.../MelodyPlugin.php:42
    4	0.0100	971880	SensioLabs\Melody\Composer\Composer->getVendorDir( )	.../Melody.php:47
    5	0.0134	1299576	Symfony\Component\Process\Process->mustRun( )	.../Composer.php:86
    

    Script ended unexpectedly.

    Ran on

    Mac OS X 10.12.4
    MAMP PRO 4.1 (Apache 2.2.31, PHP 5.2.68)
    
    opened by fosron 3
  • handle binary data

    handle binary data

    Hi!

    I am fiddling arround how I could implement a way of binary data handling within the php-console.

    e.g. I have code which open and streams a pdf, and I want the php-console to open and show the pdf in the browser when executing it..

    simple example:

    header('Content-Type: application/pdf');
    readfile('my.pdf');
    

    same use-case when creating images with e.g. GD and like to render them with the console.

    What I tried already: Make 'Content-Type' sending within php-consoles' index.php optional, so one can send the header from the eval'ed code. Now I get the data back from the server but I have not clue how I could put this give that binary string to the browser, to get it rendered/opened properly.

    Any ideas how to achvie such thing?

    opened by staabm 4
  • error while posting code

    error while posting code

    I used the following input

    <?php
    
    $it = new APCIterator('user', 'll/[^/]{1,}');
    

    and this results into a Error occured while posting your code. error.

    other input works as expected.. not sure whats going on, but it seems like the code doesn't get posted at all (therefore a client side issue).

    Tested on FF24 and Chrome 28

    opened by staabm 2
  • allow different charset

    allow different charset

    I use this great tool to debug code or do some simple tests. sometimes when digging into code from legacy systems the charset/encoding also matters.

    ATM php-console is always rendered in utf-8.

    Would you accept a PR which adds a dropdown to toggle between charsets?

    opened by staabm 5
Releases(1.4.0)
Owner
Jordi Boggiano
Working on https://packagist.com and https://teamup.com - @composer lead - OSS wishlist: https://seld.be/wishlist
Jordi Boggiano
Php Debugger to run in terminal to debug your code easily.

What is Dephpugger? Dephpugger (read depugger) is an open source lib to make a debug in php direct in terminal, without necessary configure an IDE. Th

Renato Cassino 190 Dec 3, 2022
Laravel Debugbar (Integrates PHP Debug Bar)

Laravel Debugbar This is a package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to th

Barry vd. Heuvel 14.8k Jan 9, 2023
Ray server is a beautiful, lightweight php app build on Laravel that helps you debug your app. It runs without installation on multiple platforms.

RayServer is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app. It runs without installation on multiple platforms.

Pavel Buchnev 310 Jan 2, 2023
Php Debugger to run in terminal to debug your code easily.

What is Dephpugger? Dephpugger (read depugger) is an open source library that allows a developer to debug in php direct in terminal, without necessary

Renato Cassino 190 Dec 3, 2022
An elegant debug assistant for the Laravel framework.

Introduction Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your

The Laravel Framework 4.4k Dec 27, 2022
A simple Craft module, inspired by Mildly Geeky's "Kint", to debug Twig within your browser

A simple Craft module, inspired by Mildly Geeky's "Kint", to debug Twig within your browser

TrendyMinds 4 Feb 2, 2022
Extends the Debug Bar plugin for the Sophi.io service

Debug Bar for Sophi.io Extends the Debug Bar plugin for the Sophi.io service Requirements PHP 7.4+ WordPress 5.6+ Sophi.io 1.1.0+ Debug Bar 1.0+ Insta

10up 2 Jun 22, 2022
Handle PHP errors, dump variables, execute PHP code remotely in Google Chrome

PHP Console server library PHP Console allows you to handle PHP errors & exceptions, dump variables, execute PHP code remotely and many other things u

Sergey 1.4k Dec 25, 2022
PHP APM (Alternative PHP Monitor)

APM (Alternative PHP Monitor) APM (Alternative PHP Monitor) is a monitoring extension enabling native Application Performance Management (APM) for PHP

Patrick Allaert 310 Dec 4, 2022
Zipkin PHP is the official PHP Tracer implementation for Zipkin

Zipkin PHP is the official PHP Tracer implementation for Zipkin, supported by the OpenZipkin community. Installation composer require openz

Open Zipkin 250 Nov 12, 2022
Xdebug — Step Debugger and Debugging Aid for PHP

Xdebug Xdebug is a debugging tool for PHP. It provides step-debugging and a whole range of development aids, such as stack traces, a code profiler, fe

Xdebug 2.8k Jan 3, 2023
Kint - a powerful and modern PHP debugging tool.

Kint - debugging helper for PHP developers What am I looking at? At first glance Kint is just a pretty replacement for var_dump(), print_r() and debug

null 2.7k Dec 25, 2022
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

Nette Foundation 1.6k Dec 23, 2022
PHP Benchmarking framework

PHPBench is a benchmark runner for PHP analogous to PHPUnit but for performance rather than correctness. Features include: Revolutions: Repeat your co

PHPBench 1.7k Jan 2, 2023
The Interactive PHP Debugger

The interactive PHP debugger Implemented as a SAPI module, phpdbg can exert complete control over the environment without impacting the functionality

Joe Watkins 841 Oct 9, 2022
Dontbug is a reverse debugger for PHP

Dontbug Debugger Dontbug is a reverse debugger (aka time travel debugger) for PHP. It allows you to record the execution of PHP scripts (in command li

Sidharth Kshatriya 709 Dec 30, 2022
PCOV - CodeCoverage compatible driver for PHP

PCOV A self contained CodeCoverage compatible driver for PHP Requirements and Installation See INSTALL.md API /** * Shall start recording coverage in

Joe Watkins 613 Dec 21, 2022
Low-overhead sampling profiler for PHP 7+

phpspy phpspy is a low-overhead sampling profiler for PHP. For now, it works with Linux 3.2+ x86_64 non-ZTS PHP 7.0+ with CLI, Apache, and FPM SAPIs.

Adam 1.3k Dec 24, 2022
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function that you can use instead of var_dump().

VarDumper Component The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function t

Symfony 7.1k Jan 1, 2023