Compare commits

...

4 Commits

  1. 4
      README.md
  2. 7
      composer.json
  3. 7
      src/assets/php-console.js
  4. 6
      src/assets/styles.css
  5. 4
      src/routes.php
  6. 2
      src/views/sandbox.blade.php

@ -28,8 +28,8 @@ Installation
It is a Composer package for the Laravel framework. It is a Composer package for the Laravel framework.
- Install it (`composer require mightypork/php-sandbox`), then `composer dump-autoload`. - Install it (`composer require mightypork/php-sandbox`), then `composer dump-autoload`.
- Add the service provider to your `config/app.php` file (providers section): - The service provider should be automatically found by Laravel via the discover functionality.
`MightyPork\PhpSandbox\PhpSandboxServiceProvider::class` If it is not, 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`). - 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 - Add `ENABLE_PHP_SANDBOX=true` to your .env file to enable access

@ -17,5 +17,12 @@
"psr-4": { "psr-4": {
"MightyPork\\PhpSandbox\\": "src/" "MightyPork\\PhpSandbox\\": "src/"
} }
},
"extra": {
"laravel": {
"providers": [
"MightyPork\\PhpSandbox\\PhpSandboxServiceProvider"
]
}
} }
} }

@ -83,7 +83,7 @@
*/ */
updateStatusBar = function (e) { updateStatusBar = function (e) {
var cursor_position = editor.getCursorPosition(); var cursor_position = editor.getCursorPosition();
$('.statusbar .position').text('Line: ' + (1 + cursor_position.row) + ', Column: ' + cursor_position.column); $('.statusbar .position').text('@ ' + (1 + cursor_position.row) + ':' + (1+cursor_position.column));
}; };
/** /**
@ -106,7 +106,7 @@
success: function (res, status, jqXHR) { success: function (res, status, jqXHR) {
if (res.memory || res.duration) { if (res.memory || res.duration) {
$('.statusbar .runtime-info').text('Mem usage: ' + res.memory + ' MB, Time: ' + res.duration + 'ms'); $('.statusbar .runtime-info').text('Load: ' + res.memory + ' MB, ' + res.duration + ' ms');
} else { } else {
$('.statusbar .runtime-info').text(''); $('.statusbar .runtime-info').text('');
} }
@ -154,8 +154,7 @@
editor.setOptions({ editor.setOptions({
showPrintMargin: false, showPrintMargin: false,
fontSize: '18px', fontSize: '18px',
enableBasicAutocompletion: true, enableBasicAutocompletion: true
fontFamily: 'Source Code Pro'
}); });
// set mode // set mode

@ -1,6 +1,10 @@
body, textarea, input, body .ace_editor {
font-size: 12px;
font-family: "IBM Plex Mono", "Source Code Pro", "Monaco", monospace;
}
body, textarea, input { body, textarea, input {
font-size: 12px; font-size: 12px;
font-family: "Source Code Pro", monospace;
} }
body { body {

@ -3,10 +3,10 @@
// sandbox // sandbox
if (config('php-sandbox.enable', false)) { if (config('php-sandbox.enable', false)) {
Route::group([ Route::group([
'middleware' => config('php-sandbox.route_middleware'), ['web'] 'middleware' => config('php-sandbox.route_middleware'),
], function () { ], function () {
Route::get(config('php-sandbox.route', 'sandbox'), Route::get(config('php-sandbox.route', 'sandbox'),
'\MightyPork\PhpSandbox\PhpSandboxController@index')->name('sandbox'); '\MightyPork\PhpSandbox\PhpSandboxController@index')->name('php-sandbox');
Route::post(config('php-sandbox.route', 'sandbox'), Route::post(config('php-sandbox.route', 'sandbox'),
'\MightyPork\PhpSandbox\PhpSandboxController@run'); // ajax '\MightyPork\PhpSandbox\PhpSandboxController@run'); // ajax

@ -38,7 +38,7 @@
<a id="btn-ren">ren</a> <a id="btn-ren">ren</a>
<a id="btn-del">del</a> <a id="btn-del">del</a>
&nbsp;|&nbsp; &nbsp;|&nbsp;
<span class="position">Line: 1, Column: 1</span> <span class="position">@ 1:1</span>
<span class="runtime-info"></span> <span class="runtime-info"></span>
<input type="submit" name="subm" value="Run!"/> <input type="submit" name="subm" value="Run!"/>
</div> </div>

Loading…
Cancel
Save