Skip to content

MelisPhpinfo

Diagnostic tool that renders PHP's native phpinfo() inside the Melis back office. Package melisplatform/melis-phpinfo.

Purpose

MelisPhpinfo is a single-screen Dev Tools module that captures phpinfo() output and displays it in the Melis admin, allowing an administrator to inspect the server's PHP version, loaded extensions, and runtime configuration without shell access. It has no database, service, or model layer — only one controller and three view zones. The module depends solely on melisplatform/melis-core (^5.1|^5.2) for the back-office shell.

Security note

phpinfo() exposes sensitive details — absolute paths, loaded modules, environment variables, and build flags. The tool is placed under Dev Tools intentionally; keep it restricted to trusted administrators and redact secrets before sharing any screenshot.

Enable it

Add to config/melis.module.load.php:

php
return [
    'MelisPhpinfo',
];

Requires MelisCore to be loaded first.

Backoffice

The tool appears in the left menu under MelisCore → Dev Tools → PHP Info (Dev Tools section icon: fa fa-code; tool icon: fa fa-puzzle-piece). Opening it shows the standard phpinfo() report styled to fit the Melis admin. There is nothing to configure.

Zone identifierRole
melis_phpinfo_toolContainer — forwards to MelisPhpinfo/List/render-tool
melis_phpinfo_headerTitle bar (render-tool-header)
melis_phpinfo_contentThe phpinfo() report (render-tool-content)

Key files

ConcernPath
Menu / zone registrationvendor/melisplatform/melis-phpinfo/config/app.toolstree.php
Tool namevendor/melisplatform/melis-phpinfo/config/app.interface.php
Tool configvendor/melisplatform/melis-phpinfo/config/app.tools.php
Route + controller registrationvendor/melisplatform/melis-phpinfo/config/module.config.php
Controller (3 thin actions)vendor/melisplatform/melis-phpinfo/src/Controller/ListController.php
Module bootstrapvendor/melisplatform/melis-phpinfo/src/Module.php
Container viewvendor/melisplatform/melis-phpinfo/view/melis-phpinfo/list/render-tool.phtml
Header viewvendor/melisplatform/melis-phpinfo/view/melis-phpinfo/list/render-tool-header.phtml
Report viewvendor/melisplatform/melis-phpinfo/view/melis-phpinfo/list/render-tool-content.phtml

Implementation detail

The actual phpinfo() output is produced entirely in the view layer. The controller's three actions (renderToolAction, renderToolHeaderAction, renderToolContentAction) each return an empty ViewModel; no data is passed from PHP to the view. The report view captures and sanitises the output:

php
ob_start();
phpinfo();
$phpInfoContent = ob_get_clean();
// Strip phpinfo()'s own <style> so the page inherits Melis admin CSS
$filtredPhpInfoContent = preg_replace('/<style\b[^>]*>(.*?)<\/style>/is', '', $phpInfoContent);
echo $filtredPhpInfoContent;

Module.php is boilerplate (route listener, config/autoloader) with no custom listeners or events.

See also: MelisCore