diff --git a/README.md b/README.md index 23dadb1..f2691e7 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,23 @@ $phpInfo = new \Spaze\PhpInfo\PhpInfo(); $html = $phpInfo->getHtml(); ``` -## `getHtml()` +## `getHtml(int $flags = INFO_ALL): string` The `getHtml()` method returns the `phpinfo()` output, without the HTML `head` and `body` elements, wrapped in `
` & `
`. -All inline CSS will be "externalized" to CSS classes, you can load `assets/info.css` to get the colors back. +All inline CSS will be "externalized" to CSS classes, you can load `src/assets/info.css` to get the colors back (or `vendor/spaze/phpinfo/src/assets/info.css` when installed via Composer). An example usage with Nette Framework (can be used with other frameworks or standalone, too): ```php $this->template->phpinfo = Html::el()->setHtml($this->phpInfo->getHtml()); ``` +The output may be customized by passing one or more of the constants [specified in the PHP manual](https://www.php.net/function.phpinfo#refsect1-function.phpinfo-parameters) in the optional `$flags` parameter. + Please note that this will also remove the HTML `head` element which contains `meta name="ROBOTS"` tag preventing search engines and other bots indexing the `phpinfo()` output. You have to add it back somehow, for example by rendering the `getHtml()` output in your own layout which includes the `head` element with the `meta name="ROBOTS"` tag. In general, `phpinfo()` output should be accessible only for authenticated users. -## `getFullPageHtml()` +## `getFullPageHtml(int $flags = INFO_ALL): string` Sometimes, you may want to display the classic `phpinfo()` output, with the original HTML `head` and `body` elements, `meta name="ROBOTS"` tag, inline styles etc., but still with the sensitive info sanitized (see below). In that case, you may use `getFullPageHtml()`: ```php @@ -30,6 +32,8 @@ $phpInfo = new \Spaze\PhpInfo\PhpInfo(); echo $phpInfo->getFullPageHtml(); ``` +The output of this method may also be customized by passing one or more of the constants [specified in the PHP manual](https://www.php.net/function.phpinfo#refsect1-function.phpinfo-parameters) in the optional `$flags` parameter. + ## Sanitization By default, session id will be automatically determined and replaced by `[***]` in the output. This is to prevent some session hijacking attacks that would read the session id from the cookie value reflected in the `phpinfo()` output