Back to Woocommerce

WooCommerce Email Editor Vendor-Prefixed Dependencies

packages/php/email-editor/vendor-prefixed/README.md

10.8.0-dev2.6 KB
Original Source

WooCommerce Email Editor Vendor-Prefixed Dependencies

This directory contains vendor-prefixed dependencies for the WooCommerce Email Editor package to avoid conflicts with other plugins that might include the same packages.

What is this directory?

The directory content is automatically generated by the Mozart tool and contains prefixed versions of third-party dependencies. The contents of the packages and classes directories are automatically generated during composer install and composer update.

Key Features

  • Namespace Prefixing: All namespaces are prefixed with Automattic\WooCommerce\EmailEditorVendor\
  • Classmap Prefixing: Classmap classes are prefixed with EmailEditorVendor_
  • Conflict Avoidance: Prevents conflicts with plugins that include the same packages
  • Automatic Generation: Contents are automatically managed by Mozart

Current Dependencies

  • pelago/emogrifier (v7.3.0): CSS inlining library for email HTML processing

Important Notes

⚠️ Do not make direct changes to files in the packages or classes directories! Any manual changes will be lost when the dependencies are regenerated.

How it Works

  1. Dependencies are defined in composer.json under require-dev
  2. Mozart configuration in composer.json specifies prefixing rules
  3. During composer install/update, Mozart automatically:
    • Downloads the original packages
    • Prefixes namespaces and class names
    • Generates the prefixed versions in this directory
    • Cleans up the original vendor directories

Mozart Configuration

The Mozart configuration in composer.json includes:

  • dep_namespace: Automattic\WooCommerce\EmailEditorVendor\
  • dep_directory: /packages/
  • classmap_directory: /classes/
  • classmap_prefix: EmailEditorVendor_
  • delete_vendor_directories: true

Usage

The prefixed dependencies are automatically loaded through the main package's autoloader. You don't need to interact with this directory directly - use the dependencies through their prefixed namespaces in your code.

Adding new package

  • Add a new package as a dev dependency e.g, composer require PACKAGE_NAME --dev
  • Run composer install from email editor PHP package root e.g, composer install
  • composer.json - Contains Mozart configuration and dependency definitions
  • composer.lock - Locks dependency versions for reproducible builds
  • ../src/class-email-css-inliner.php - Uses the prefixed Emogrifier package

For more information about the Email Editor package, see the main README.md.