fballiano/openmage-cssjs-minify Dependencies: PHP Requirements and Composer Packages

The fballiano/openmage-cssjs-minify package requires PHP 7.4 or newer, the magento-hackathon/magento-composer-installer for Magento module placement, and matthiasmullie/minify ^1.3 as the core minification engine.

The fballiano/openmage-cssjs-minify module is a Magento 1.x/OpenMage extension that automatically minifies CSS and JavaScript assets. Understanding its dependency tree is essential for successful installation and troubleshooting compatibility issues with your existing Magento installation.

Core Dependencies Defined in composer.json

The package declares three mandatory requirements in composer.json (lines 13-17):

  • PHP >=7.4.0 – The minimum runtime requirement ensuring compatibility with modern OpenMage LTS and legacy Magento 1.9.x installations upgraded from older PHP versions.
  • magento-hackathon/magento-composer-installer – Enables Magento-style module installation via Composer, handling automatic placement of files under app/code/community/Fballiano/CssjsMinify/ and module declarations in app/etc/modules/.
  • matthiasmullie/minify ^1.3 – The core minification library that provides MatthiasMullie\Minify\CSS and MatthiasMullie\Minify\JS classes. The observer class simply wires this library into Magento’s page rendering flow.

How Dependencies Integrate with Magento

The dependency chain creates a complete minification pipeline:

  1. The magento-composer-installer places app/code/community/Fballiano/CssjsMinify/Model/Observer.php and app/code/community/Fballiano/CssjsMinify/etc/config.xml in the correct locations upon composer install.
  2. config.xml registers the observer for the controller_action_layout_render_before event.
  3. When triggered, Observer.php uses the matthiasmullie/minify library to compress CSS and JS files, storing results in media/cssjs/minified/.

Installation and Verification

Install the package and verify dependencies:


# Install the module and its dependencies

composer require fballiano/openmage-cssjs-minify

# Verify the magento-composer-installer placed files correctly

ls -la app/code/community/Fballiano/CssjsMinify/

Check that matthiasmullie/minify is present:

ls vendor/matthiasmullie/minify/

Implementation Details in Source Files

The Observer.php file demonstrates how the matthiasmullie/minify dependency is invoked:

// app/code/community/Fballiano/CssjsMinify/Model/Observer.php
public function minifyAssets(Varien_Event_Observer $observer)
{
    // Grab the whole HTML output
    $html = $observer->getEvent()->getTransport()->getOutput();

    // Find CSS/JS tags and replace them with minified versions
    $html = preg_replace_callback($pattern, function($matches) use ($baseDir, $minifiedDir, $minifiedUrl) {
        // Matthias Mullie's Minify library does the heavy lifting
        $minifier = $matches[1] === 'css'
            ? new \MatthiasMullie\Minify\CSS()
            : new \MatthiasMullie\Minify\JS();

        foreach ($files as $file) {
            $minifier->add($baseDir . $file);
        }

        $minifiedPath = $minifiedDir . $hash . '.' . $matches[1];
        $minifier->minify($minifiedPath);

        // Return a new HTML tag pointing to the minified file
        return sprintf('<%s src="%s"/>', $matches[1] === 'css' ? 'link rel="stylesheet" href' : 'script src', $minifiedUrl . '/' . $hash . '.' . $matches[1]);
    }, $html);

    $observer->getEvent()->getTransport()->setOutput($html);
}

Source: Observer.php – callback usage of the Minify library

Summary

  • The fballiano/openmage-cssjs-minify package requires PHP 7.4+, magento-hackathon/magento-composer-installer, and matthiasmullie/minify ^1.3.
  • The composer.json file (lines 13-17) declares these requirements for automatic resolution.
  • The magento-composer-installer handles Magento-specific file placement in app/code/community/ and app/etc/modules/.
  • The matthiasmullie/minify library provides the actual CSS and JavaScript compression algorithms consumed by Observer.php.

Frequently Asked Questions

What PHP version is required for fballiano/openmage-cssjs-minify?

The package requires PHP 7.4.0 or newer. This constraint ensures compatibility with modern OpenMage LTS releases while maintaining support for legacy Magento 1.9.x installations that have been upgraded from older PHP versions.

Does this package work with standard Magento 1.x installations?

Yes, but you must use Composer with the magento-hackathon/magento-composer-installer. This dependency handles the non-standard file placement required by Magento 1.x, automatically copying files to app/code/community/Fballiano/CssjsMinify/ and creating the module declaration in app/etc/modules/Fballiano_CssjsMinify.xml.

How does the matthiasmullie/minify library integrate with Magento?

The library is instantiated in app/code/community/Fballiano/CssjsMinify/Model/Observer.php. When the controller_action_layout_render_before event fires, the observer creates MatthiasMullie\Minify\CSS and MatthiasMullie\Minify\JS objects, passes source file paths to them, and writes minified output to media/cssjs/minified/.

Can I use this package without Composer?

No. The magento-hackathon/magento-composer-installer is a mandatory dependency that manages the module's placement within the Magento directory structure. Manual installation would require replicating this installer's behavior, including proper placement of files in app/code/community/ and app/etc/modules/, which is not documented or supported by the package maintainers.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →