(written by Grok and reviewed by Max Milbers)

Audience: Developers hitting “class not found” on Linux that never happened on Windows
File: VirtueMart’s Composer ClassLoader (classmap keys in lowercase)

1. Why this exists

PSR-4 autoload is case-sensitive. VmHtml and VmHTML are one class in a human head and two different files on Linux. Staging on Windows or macOS hides it. Production dies. A shop that ran for ten years with mixed new VmHtml / new VmHTML is PHP history, not a moral failure.

The PHP world treated case-sensitive autoload as professionalism. VirtueMart has fifteen years of mixed case. We did not rewrite every new in the universe in one night.

2. What VirtueMart does

The ClassLoader looks up the classmap with strtolower($class). Map keys are lowercase. VmHtml, VmHTML and vmhtml hit the same file.

$classToLower = strtolower($class);
if (isset($this->classMap[$classToLower])) {
	return $this->classMap[$classToLower];
}

Composer was pulled out of the frontend; FE helpers sit in the common classmap. No extra strtolower on every include beyond that lookup.

3. Views still need unique class names

Lowercase map does not allow two files to declare the same class. HTML / JSON / feed views used to share a name. VirtueMart 5 names them by format: VirtueMartViewJsonCategory, VirtueMartViewFeedCategory. Some backend classes, like controllers get a BE suffix. 

4. Do’s and don’ts

  • Prefer the real class name in new code (VmHtml, namespace VirtueMart).
  • Do not add a second classmap entry with different case — one file, one class.
  • Plugins stay un-namespaced (Joomla). Core is namespace VirtueMart.
  • Core frontend layouts must not use that namespace (template overrides).