Giter Site home page Giter Site logo

php-console's Introduction

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

php-console's People

Contributors

cordoval avatar davgothic avatar enderandpeter avatar fawmi avatar kevinrob avatar mikesimonson avatar rlerdorf avatar seldaek avatar silvanm avatar silverfire avatar staabm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-console's Issues

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.

Have error

I am using mamp pro php 5.3
and have this problem
Parse error: syntax error, unexpected '"', expecting T_STRING in /Users/Denis/Desktop/PHP/TempG/php-console/index.php(56) : eval()'d code on line 1

When I use date("Y") or date('Y')

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

How can I change the ACE editor Theme?

Hi, Actually I like to change the theme of the editor. Where should I edit the code to get it work!
I tried
editor.setTheme("idle_fingers");
But its not working!

Required files not included or dependencies not listed

I cloned the repository and php-console immediately failed at runtime due to this statement on line 47 of index.php:

require 'vendor/autoload.php';

This file is not included, nor is it immediately obvious where to acquire it. I commented out the line, which allowed php-console to actually load the console. I then attempted to test a simple code, but in the right column received error:

Fatal error: Class 'SensioLabs\Melody\Resource\ResourceParser' not found in MelodyPlugin.php on line 17

Are these prerequisite dependencies? README mentions nothing of this, so either the issue is that they are missing and should be bundled, or that the instructions omit the fact that they must be installed separately as dependencies.

Fatal error: require(): Failed opening required 'vendor/autoload.php'

Just checkout master branch, that's it. there is not directory for file for vendor or file autoload.php, they why are including it in index.php?

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/php-console/index.php on line 47 Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/php-console/index.php on line 47

config.php

<?php

return array(
    // how many spaces to use for indention, 0 will make it use real tabs
    'tabsize' => 4,

    // whitelist of IPs which don't need to be authenticated
    // use '*' to allow any IP
    'ip_whitelist' => array('*'),

    // bootstrap file, if defined this file will be included before
    // the code entered by the user is evaluated. any variables and classes
    // defined here will be accessible by the eval'd code
    'bootstrap' => null,
);

error gone by following commands

mkdir vendor
touch vendor/autoload.php

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

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.

packagist integration

why isn't this bundle availbale over packagist and therefore can be installed using composer?

vendor folder missing

Downloaded the zipped folder from here and tried to run it and it can't find the autoload.php file in the vendor folder. There's no vendor folder.

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!

line numbers are in-accurate

some parts of the posted code are processed and therefore line-numbers from the error on client side do not match with the origin input.

example input:

<?php
throw new Exception('lala');

outputs

Uncaught exception 'Exception' with message 'lala' in /home/COMPLEX/mstaab/htdocs/tools/php-console/index.php(64) : eval()'d code:1

but in fact the error is on line 2 in the origin code. The issue in this example is, that on server side <?php is stripped from the source.

I will provide a PR which leaves a empty line for the origin <?php tag (and remove the trim() to get this aligned again.

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?

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 ?

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?

Resizable code editor

Is there a way for u to make a code editor area resizable?
Something like on jsfiddle

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?)

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)

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..)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.