Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
unfulvio committed Jun 3, 2016
1 parent 5a31249 commit c69b97b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

### 1.5.0 (29 May 2016)
### 1.5.0 (03 Jun 2016)
* Fix: Fixes "PHP Warning: session_start(): Cannot send session cache limiter - headers already sent" notice in logs
* Misc: Internal changes, new Settings class, deprecated methods and properties in main Plugin class
* Misc: Updated PHP Console Library to 3.1.6
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@

An implementation of [PHP Console](https://github.com/barbushin/php-console "PHP Console") as a [WordPress](http://www.wordpress.org) plugin. Use Chrome Dev Tools to debug your WordPress installation!

<sup>Note: this is the development repository. If you download a zip from the master branch here you'll also need to build the plugin using `npm install` and then `grunt build` since it uses composer to manage dependencies. Or you can simply download the packaged plugin in the latest publicly released version from [wordpress.org]((https://wordpress.org/plugins/wp-php-console/)) and you'll be ready to go.</sup>

## Description

> PHP Console allows you to handle PHP errors & exceptions, dump variables, execute PHP code remotely and many other things using [Google Chrome extension PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef) and [PHP Console server library](https://github.com/barbushin/php-console).
This implementation of PHP Console makes easy to debug a WordPress installation from Chrome browser JavaScript console and test any WordPress specific function or class (including those introduced by your active theme and plugins!) from a terminal. You can run any PHP or WordPress specific function and inspect results, catch errors and warnings with call stack trace straight which will be displayed in the Chrome JavaScript console. You can do PHP debugging alongside your JavaScript debugging in one place, without having PHP to print errors and warnings in your HTML page.
This implementation of PHP Console is a handy tool to make it easier to test on the fly any WordPress specific function or class (including those introduced by your active theme and plugins!) from a terminal and inspect results, catch errors and warnings with complete call stack trace straight from the Chrome JavaScript console. In other words, besides debugging, you can execute PHP or WordPress-specific PHP code straight from the terminal and print PHP variables in Chrome Dev Tools JavaScript console along with your normal JavaScript debugging and testing. Keep everything in one place, without leaving the browser to check for your logs or writing temporary PHP test code on a PHP file and refresh your browser page.

[![Download from WordPress.org](https://github.com/nekojira/wp-php-console/blob/master/assets/wordpress-download-btn.png)](https://wordpress.org/plugins/wp-php-console/)


## Installation

Note: you will need PHP 5.4.0 minimum version on your machine or server to run this plugin.
Note: you will at least PHP 5.4.0 or above installed on your machine or server to run this plugin.

1. First, install [Google Chrome extension PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef) from the [Chrome WebStore](https://chrome.google.com/webstore/search/php%20console?_category=extensions).
Make sure the PHP Console Chrome extension is enabled through [chrome://extensions/](chrome://extensions/ "chrome://extensions/").
Expand Down
20 changes: 12 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Use Chrome Dev Tools to debug your WordPress installation!

> PHP Console allows you to handle PHP errors & exceptions, dump variables, execute PHP code remotely and many other things using [Google Chrome extension PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef) and [PHP Console server library](https://github.com/barbushin/php-console).

This implementation of PHP Console offers yet another tool to make it more easy to test on the fly any WordPress specific function or class (including those introduced by your active theme and plugins!) from a terminal and inspect results, catch errors and warnings with call stack trace straight from the Chrome JavaScript console. In other words, besides debugging, you can execute PHP or WordPress-specific PHP code straight from the terminal and print PHP variables in Chrome Dev Tools JavaScript console as if it were Javascript. It's very handy to keep everything in one place.
This implementation of PHP Console is a handy tool to make it easier to test on the fly any WordPress specific function or class (including those introduced by your active theme and plugins!) from a terminal and inspect results, catch errors and warnings with complete call stack trace straight from the Chrome JavaScript console. In other words, besides debugging, you can execute PHP or WordPress-specific PHP code straight from the terminal and print PHP variables in Chrome Dev Tools JavaScript console along with your normal JavaScript debugging and testing. Keep everything in one place, without leaving the browser to check for your logs or writing temporary PHP test code on a PHP file and refresh your browser page.

Note: PHP 5.4.0 minimum version is required to use this plugin.
Note: PHP version 5.4.0 or above is required to use this plugin.

For support and pull requests, please refer to [WP PHP Console GitHub repo](https://github.com/unfulvio/wp-php-console) and read the instructions there - thank you.

Expand Down Expand Up @@ -68,7 +68,7 @@ The result includes the output, the return value and the net server execution ti

In your PHP code on the Server, you can call PHP Console debug statements like `PC::debug( $var, $tag )` to display PHP variables in the JavaScript console and optionally filter selected tags through the PHP Console eval & options form opened from the address bar in your browser.

In the JavaScript console you will see printed any PC::debug() information, PHP errors, warnings, notices with optional stack trace, which will be useful to debug your plugin or theme.
In the JavaScript console you will see printed any `PC::debug()`` information, PHP errors, warnings, notices with optional stack trace, which will be useful to debug your plugin or theme.

== Frequently Asked Questions ==

Expand All @@ -84,6 +84,10 @@ No it doesn't, unless PHP Console browser extension is ported, for example, as a

You *can* but it is probably not a good idea. You should do your debugging and testing on a development/testing environment on a staging server or local machine. Likewise, you normally wouldn't want to turn on PHP error reporting or set WP_DEBUG to true in a live site as you wouldn't want to display error information to public. Furthermore, PHP Console allows execution of any remote PHP code through terminal - for this you can set a strong password and restrict the IP address range to access the terminal, but still it's not advisable. Besides putting your site at risk, you will also add more load to your server.

= Will there be items logged in my debug.log files when a PHP error occurs? =

Generally no, WP PHP Console will intercept those. However, it's always a good idea to keep an eye on the logs too. Furthermore, WP PHP Console is unable to catch many server errors that result in a 500 error code on the browser. For those you may have traces left in the debug.log file.

= Why are PHP arrays shown as objects? =

The JavaScript console prints PHP variables as JavaScript variables. Associative PHP arrays such as `['key1' => 'var2', 'key2' => 'var2', ... ]` are shown as objects; automatically indexed arrays like `[ 'var1', 'var2', ... ]` are shown as arrays.
Expand All @@ -96,9 +100,9 @@ You could move your debug code or either do something like

`
// delay use of PC class until WP PHP Console plugin is included
add_action('plugins_loaded', function () use ($my_var) {
add_action( 'plugins_loaded', function () use ( $my_var ) {
// send $my_var with tag 'my_tag' to the JavaScript console through PHP Console Server Library and PHP Console Chrome Plugin
PC::my_tag($my_var);
PC::my_tag( $my_var );
});
`

Expand All @@ -109,10 +113,10 @@ or
require_once dirname( __FILE__ ) . '/wp-php-console/vendor/autoload.php';

// make PC class available in global PHP scope
if( !class_exists( 'PC', false ) ) PhpConsole\Helper::register();
if ( ! class_exists( 'PC', false ) ) PhpConsole\Helper::register();

// send $my_var with tag 'my_tag' to the JavaScript console through PHP Console Server Library and PHP Console Chrome Plugin
PC::my_tag($my_var);
// send $my_var with tag 'my_tag' to the JavaScript console through PHP Console Server Library and PHP Console Chrome Plugin
PC::my_tag( $my_var );

`

Expand Down

0 comments on commit c69b97b

Please sign in to comment.