Utility for running PHP code inside the browser (Laravel package)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Ondřej Hruška 6de8eca8ee
initial code import
6 years ago
src initial code import 6 years ago
.gitignore initial code import 6 years ago
LICENSE.txt initial code import 6 years ago
README.md initial code import 6 years ago
composer.json initial code import 6 years ago

README.md

PHP Sandbox

~ Improved & slimmed down fork of Seldaek/php-console ~

A web editor to try your PHP code.

This allows you to run small bits of code easily right from your browser, in the context of your Laravel application.

There is no sandboxing or security built in, this is meant for testing in a local dev environment. The sandbox routes can be enabled using ENABLE_PHP_SANDBOX=true in .env, it is disabled by default.

Tip: Press Ctrl+Enter to evaluate the code

About this fork

This is a fork of the original code by Seldaek (Jordi Boggiano), cleaned and turned into a Laravel package.

Changes:

  • Changed colors to look more like Sublime Text, with Monokai theme
  • Slightly improved layout
  • Removed info text at the bottom of the screen
  • Output is now plain text, not HTML (more useful for debugging). However, some html output works too (in particular dd())
  • Removed "krumo", "clippy", and "Melody (bloat from the original version)
  • Updated ACE to 1.2.0 with a patch to support the PHP trait keyword
  • Removed the loader animation (it was broken)

Installation

It is a Composer package for the Laravel framework.

  • Install it (composer require mightypork/php-sandbox), then composer dump-autoload.
  • Add the service provider to your config/app.php file (providers section): MightyPork\PhpSandbox\PhpSandboxServiceProvider::class
  • Run php artisan vendor:publish and select the package; this copies the JS and CSS assets to your public folder, and creates the config file (config/php-sandbox.php).
  • Add ENABLE_PHP_SANDBOX=true to your .env file to enable access

The sandbox is available at /sandbox.

If you wish to change the path, that can be done in the config file. You can also decide which middleware to use.

License

PHP Console is licensed under the New BSD License.