MODRACXKENNETH D'SILVA

← Documentation Hub

Magento 2 Admin Dev Tools: Reference Manual

An in-admin developer control center for Magento 2. Flush specific cache pools in one click, tail multi-megabyte log files with zero PHP memory exhaustion, trigger single-indexer runs, and inspect DI interceptor chains directly inside Magento Admin.

1. Overview & Architectural Objectives

Developing on Magento 2 routinely involves jumping out of the browser into an SSH terminal to run bin/magento cache:clean, tail var/log/system.log, or verify which plugin interceptor is overriding a core pricing calculation. On remote staging environments or for non-root developers without direct SSH access, this workflow creates friction.

Modracx_AdminDevTools brings these low-level developer operations directly into the Magento Admin Panel via asynchronous AJAX endpoints, secured with strict Magento ACL permissions.

2. Requirements & Compatibility Matrix

Requirement Supported Versions Notes
Magento Open Source / Commerce 2.4.4, 2.4.5, 2.4.6, 2.4.7+ PHP 8.1, 8.2, and 8.3 fully verified
PHP Version PHP >= 8.1 Uses typed properties and constructor promotion
Cache Backends Redis, File, Varnish (FPC) Direct socket connection to Redis for atomic tag flushes
Search & Catalog OpenSearch 2.x, Elasticsearch 7.x Index status & reindex triggers supported

3. Installation via Composer

# 1. Require the package via Composer
composer require modracx/module-admin-dev-tools

# 2. Enable the module and execute database/setup upgrade
bin/magento module:enable Modracx_AdminDevTools
bin/magento setup:upgrade

# 3. Recompile Dependency Injection and deploy static content (production mode)
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f

# 4. Clean configuration cache
bin/magento cache:clean config

4. Core Feature Reference

4.1. Fast Cache Pool Manager

Located in the admin top navigation toolbar. Allows clearing individual cache types (e.g. config, layout, block_html, full_page) without reloading the full page via JSON endpoints. Flushes execute in < 40ms by speaking directly to the Redis backend adapter.

4.2. Memory-Safe Reverse Log Streamer

Standard PHP log viewers often use file_get_contents() or file(), which will immediately trigger Allowed memory size exhausted on 500MB production log files. Modracx_AdminDevTools uses a binary chunked backward seek algorithm:

// Streaming the last 200 lines by seeking from the end of file (EOF)
$fp = fopen($logFilePath, 'rb');
fseek($fp, -4096, SEEK_END);
$buffer = fread($fp, 4096);
fclose($fp);

4.3. DI Interceptor & Plugin Tree Viewer

Enter any fully qualified class name (e.g. Magento\Catalog\Model\Product) in System > Dev Tools > Interceptors to inspect the exact plugin execution stack, sort orders, before/around/after hooks, and preference bindings across global, frontend, and adminhtml areas.

5. Configuration & Access Control (ACL)

Admin Dev Tools enforces granular permissions defined in etc/acl.xml. Junior admin users or content editors can be restricted from flushing caches or viewing system logs:

<!-- etc/acl.xml excerpt -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Modracx_AdminDevTools::root" title="Admin Dev Tools" sortOrder="100">
                    <resource id="Modracx_AdminDevTools::cache" title="Cache Actions" />
                    <resource id="Modracx_AdminDevTools::logs" title="View System Logs" />
                    <resource id="Modracx_AdminDevTools::di" title="Inspect DI Plugins" />
                </resource>
            </resource>
        </resources>
    </acl>
</config>

6. Troubleshooting & FAQs

Toolbar not appearing in admin? Check that the user's admin role has the Modracx_AdminDevTools::root resource enabled in System > User Roles, and ensure you have deployed static content with bin/magento setup:static-content:deploy.

Log file shows empty? Verify Linux file permissions. The web server user (www-data or nginx) must have read permissions on files within var/log/.