SmallMart
SmallMart Community
Documentation

MODS.md

Back to Docs

Mods (SmallMart v6.1.5.5)

SmallMart supports outside development of mods. Mods let you add features without editing the core.

Where mods live

  • Legacy: `mods/your_mod.php`
  • Package: `mods/<mod-id>/manifest.json` + entry file

Package Mod (recommended)

Folder layout:
  • `mods/hello-world/manifest.json`
  • `mods/hello-world/main.php`
`manifest.json` example:
json
{
  "id": "hello-world",
  "name": "Hello World Banner",
  "version": "1.0.0",
  "description": "Adds a banner on the homepage",
  "author": "Your Name",
  "entry": "main.php",
  "enabled_by_default": true
}

`main.php` example:

php
<?php
function init() {
  if (!class_exists('SmallMartModAPI')) return;
  SmallMartModAPI::addHook('home_before_content', function () {
    echo '<div class="alert alert-success">Hello from a mod!</div>';
  }, 10);
}

Best practices

  • Keep mods self-contained
  • Avoid editing core files
  • Validate input, escape output
  • If you add files, store them under `data/` or `uploads/` (as appropriate)
  • Include a README in your mod zip (install steps + compatibility)