Skip to content
Everett Griffiths edited this page Jun 24, 2014 · 5 revisions

Spec

Creating Composer packages for MODX Revolution : the specifications.

Goals

This spec should define how PHP developers can author standard Composer packages which can be installed in MODX Revolution so that:

  • The development and installation workflow involved is the same as creating "normal" composer/packagist packages.
  • MODX packages can be made available via Packagist
  • Dependencies should be referenced and resolved in the standard composer way: by referencing them by name in the composer.json "require" node.
  • The workflow should be compatible with the envisioned future versions of MODX when MODX itself is a composer-driven application.

File Locations

Assets

All files that must be web-accessible are referred to as "assets" and they must be stored in a dedicated folder. This folder shall be defined by "extra":{"assets_path":"assets/"}, default: assets/

Core Path

Files intended to be installed to the core/{$packagename}/ folder shall comprise the bulk of the package. This folder shall be defined by "extra":{"core_path":""}, and the default shall be the repository root.

Elements

Elements are defined as any chunk of PHP code or HTML that must be registered within the MODX CMS to provide formatting or functionality. Although an element may reference additional files (e.g. a CSS style sheet or a PHP class), the element itself must consist of a single file. Elements currently consist of Templates, Chunks, Snippets, Plugins, and Template Variables (i.e. custom fields). These should be contained in their own directory defined by "extra":{"elements_path":""}, and the default shall be elements/. The type of element shall be determined by the sub-directories inside of the elements/ directory, e.g. templates/, chunks/, snippets/, plugins/, and tvs/.

Controllers

Model

Clone this wiki locally