outcompute/phpinfo

Get the output of phpinfo() as an array.

Installs: 47 147

Dependents: 1

Suggesters: 0

Security: 0

Stars: 6

Watchers: 1

Forks: 8

Open Issues: 1

pkg:composer/outcompute/phpinfo

1.1.0 2020-01-08 14:01 UTC

This package is not auto-updated.

Last update: 2025-09-28 02:11:19 UTC


README

A simple PHP library to get the output of phpinfo() as an array when invoked from a command line script. You can submit a PR if you adapt it to the HTML version. Although by now you can compile the information to a reasonable degree of completeness from other functions, so this will be of use only when you absolutely have to parse phpinfo().

  • Returns nested information for Configuration, modules in Configuration, Environment, PHP Variables & PHP License

Installation

Add this line to your composer.json file,

"outcompute/phpinfo": "1.0.0"

and run.

$ composer update

How to use

<?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());
?>

TODO

(PRs are welcome)

  • Add support for parsing the HTML version (the _parseHTML() method)
  • Add test cases

License

GPL v2