| 1 |
=== WP Console - WordPress PHP Console powered by PsySH === |
| 2 |
Contributors: ediamin |
| 3 |
Tags: console, repl, browser, psysh, shell, dump |
| 4 |
Requires at least: 5.3.12 |
| 5 |
Tested up to: 6.3 |
| 6 |
Requires PHP: 5.6 |
| 7 |
Stable tag: 2.4.0 |
| 8 |
License: GPLv3 |
| 9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 10 |
|
| 11 |
An in-browser PHP console for WordPress powered by PsySH |
| 12 |
|
| 13 |
== Description == |
| 14 |
WP Console brings the renowned PsySH directly to your browser. PsySH serves as a runtime developer console, an interactive debugger, and a PHP REPL (Read-Eval-Print Loop). |
| 15 |
|
| 16 |
To utilize WP Console, simply write your code within the code editor, then press Cmd-Enter (mac) or Ctrl-Enter (win/linux) to instantly view the output in your browser. |
| 17 |
|
| 18 |
Moreover, you have the option to employ PsySH alongside wp-cli by executing the command `wp shell`. Notably, wp-cli comes with inherent compatibility for psysh. All that is required is the activation of WP Console to leverage this feature. |
| 19 |
|
| 20 |
== Features == |
| 21 |
- Powerful code editor powered by Ace Editor. |
| 22 |
- Real-time autocompletion for PHP core and WordPress functions, complete with placeholders. |
| 23 |
- Introducing `_dump` as a more versatile alternative to `var_dump`, leveraging the capabilities of Symfony VarDumper. |
| 24 |
- Instant access to debug.log contents, with the added convenience of clearing them directly from your browser. |
| 25 |
- Enhanced shell experience courtesy of psySH, facilitating advanced interaction through `wp shell`. |
| 26 |
- Customizable code snippet functionality, compatible with VS Code supported code snippets. Explore examples like these [WooCommerce snippets](https://github.com/claudiosanches/vscode-woocommerce/blob/master/snippets/functions.json). |
| 27 |
|
| 28 |
Please note that certain PsySH commands, such as `ls`, `doc`, `show`, and magic variables like `$_`, `$__class`, are not currently supported in the browser console. |
| 29 |
|
| 30 |
👉 WP Console uses Gutenberg packages and components to ensure a seamless and user-friendly UI/UX. |
| 31 |
|
| 32 |
== Getting Started == |
| 33 |
To begin using the plugin, follow these steps: |
| 34 |
|
| 35 |
1. Activate the plugin within your WordPress setup. |
| 36 |
2. Look for a quick link labeled "Console" in the WP Admin Bar on the right-hand side (see the second screenshot below). |
| 37 |
3. Click on the "Console" link to access the WP Console panel. |
| 38 |
|
| 39 |
== Security Concern == |
| 40 |
WP Console explicitly verifies the presence of the `manage_options` permission to render the user interface and execute various functions. However, it's important to note that this plugin is not intended for use on a production server. |
| 41 |
|
| 42 |
== Screenshots == |
| 43 |
|
| 44 |
1. Basic input output |
| 45 |
2. How to open the browser console |
| 46 |
3. _dump command |
| 47 |
4. Vertical splitted window |
| 48 |
5. Live Autocompletion |
| 49 |
6. Autocompletion with placeholder |
| 50 |
7. Display errors |
| 51 |
8. wp shell command |
| 52 |
9. Get debug.log contents |
| 53 |
10. Clear debug.log |
| 54 |
11. Add/Edit custom snippets |
| 55 |
12. Custom snippets in action |
| 56 |
|
| 57 |
== Changelog == |
| 58 |
|
| 59 |
2.4.0 - August 09, 2023 |
| 60 |
* Add support for PHP 8.0+. |
| 61 |
* Update psysh version to 0.10.12. |
| 62 |
* Update Ace Editor version to 1.23.4. |
| 63 |
|
| 64 |
2.3.1 - July 31, 2022 |
| 65 |
* Update script version of ace. |
| 66 |
|
| 67 |
2.3.0 - July 27, 2022 |
| 68 |
* Add code execution time in console output panel. |
| 69 |
* Use ace.js with custom namespace to avoid conflict with other ace.js source. |
| 70 |
* Fix snippet manager module style. |
| 71 |
* Use verticle split as default in console panel. |
| 72 |
* Fix error handling for PHP v5.6. |
| 73 |
* Fix some UI issues in different WordPress versions. |
| 74 |
* Add wp-env and e2e testing with Jest using wp-scripts for developing the plugin. |
| 75 |
|
| 76 |
2.2.0 - November 22, 2020 |
| 77 |
* Add custom code snippet support. You can use VS Code supported PHP code snippets now. |
| 78 |
* Add Copy Output button. |
| 79 |
* Enqueue scripts only for manage_options capability owners. |
| 80 |
* Improve handling uncaught fatal errors. |
| 81 |
* Add Twenty Twenty theme compatibility. |
| 82 |
* Set default values for user Console settings in REST API. |
| 83 |
* Fix horizontal output scolling issue for vertically split console. |
| 84 |
* Fix close button get disappear in WooCommerce admin pages. |
| 85 |
* Fix error line no in console editor. |
| 86 |
|
| 87 |
2.1.0 - April 14, 2020 |
| 88 |
* Lazy load React components to improve performance. |
| 89 |
* Use a single store source for all components. |
| 90 |
* Reset console responses after close app window. |
| 91 |
* Fix navigation button icon css for WP v5.4. |
| 92 |
* Resize editor screen after toggle split mode. |
| 93 |
|
| 94 |
2.0.0 - December 11, 2019 |
| 95 |
* Revamp UI/UX. |
| 96 |
* Add Ace editor as code editor plugin. Remove CodeMirror. |
| 97 |
* Live autocompletion with placeholders. |
| 98 |
* Option to vertically split editor and output window. |
| 99 |
* Add ability to clear debug.log. |
| 100 |
* Restrict plugin UI and REST APIs for users who have manage_options capability. |
| 101 |
|
| 102 |
1.5.0 - November 07, 2019 |
| 103 |
* Tweak - Change `dump` function name to `_dump` to resolve conflict with wp-erp. |
| 104 |
|
| 105 |
1.4.0 - November 02, 2019 |
| 106 |
* New - Save code editor history in localStorage. |
| 107 |
* Tweak - Use wp-scripts for assets build process. |
| 108 |
|
| 109 |
1.3.0 - October 26, 2019 |
| 110 |
* New - Fetch debug.log contents. |
| 111 |
* Tweak - Support PHP version 5.6. |
| 112 |
|
| 113 |
1.2.0 - July 27, 2019 |
| 114 |
* New - Add autocompletion data(WP functions, PHP booleans, constants, functions, keywords). |
| 115 |
* New - Add codemirror closebrackets, matchbrackets addon scripts. |
| 116 |
* New - Show error stacktrace. |
| 117 |
|
| 118 |
1.1.0 - June 25, 2019 |
| 119 |
* New - Use output buffer handler. |
| 120 |
* New - Add build process. |
| 121 |
* Tweak - Remove unnecessary code. |
| 122 |
|
| 123 |
1.0.0 - June 21, 2019 |
| 124 |
Initial release. |
| 125 |
|