But of course in normal mode not CLI. Formated output included among other HTML destroys existing webpage layout.
I just got done creating the composer library for this very purpose. Right now, it can parse the phpinfo() output when invoked from the command line, which was my use case.
Instead of using strip_tags() or any clever trick, I just worked my way backwards from everything that the original function did.
You can use the library like so:
<?php
include_once('vendor/autoload.php');
ob_start();
phpinfo();
$phpinfoAsString = ob_get_contents();
ob_get_clean();
$phpInfo = new OutCompute\PHPInfo\PHPInfo();
$phpInfo->setText($phpinfoAsString);
var_export($phpInfo->get());
?>
You can access keys within modules and elsewhere:
echo $phpInfoArray['Configuration']['bz2']['BZip2 Support']; # Will output 'Enabled' if enabled
or
echo $phpInfoArray['Thread Safety'] # Will output 'disabled' if disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With