Skip to content
You are reading the docs for ShopClass 7.1.0.dev1, still in development. Read the stable docs.

Developer documentation

ShopClass is extended the way Osclass was: hooks to run your code at the right moment, helpers to read and write the application’s data, and routes to add pages of your own. That API was kept deliberately through the modernisation: the osc_* helper functions, hook names, admin CSS class names and oc-includes/assets/ paths are treated as a public API and were not renamed.

If you wrote for Osclass, you already know most of this.

Worth knowing before you port something:

  • PHP 8 throughout. The floor is 8.2. Code that relied on PHP 7 leniency (implicit type juggling, dynamic properties, create_function) will fatal.
  • jQuery is not loaded for you. The admin panel is Bootstrap 5 and registers bootstrap5, popper and sortablejs; the front end loads nothing by default. A plugin that assumed $ was present must now register and enqueue its own copy.
  • A real CLI. oc-cli.php covers cron, migrations, packages and health checks: see the CLI reference.
  • A package registry. Plugins and themes are published through the market instead of ad-hoc update URLs.
  • oc-includes/assets/chart-js/ is gone as of 6.2.0. It was added in 2021 and never used by anything in core. A plugin loading that path directly must bundle its own copy.
  • Delete cascades run in transactions, and every record type now fires a hook before the transaction opens and after_delete_* only once it has committed, so your own database work is never rolled back with a failed delete. Most types name the first hook before_delete_*; category and user deletes name it delete_category and delete_user instead.
If you want to… Read
Publish a plugin or theme Package specification
Get it listed for every install The market
Run your code inside core Hooks and filters
Find the osc_* helper for a job Helper functions
Know which core class to call, and where hooks fire Architecture
Add a page of your own Routes
Add admin screens Administrator menus
Add an admin settings page Settings pages
Build an admin add/edit screen Admin editors
Take payments Payment gateways
Call another service over HTTPS HTTP client
Add toolbar shortcuts Admin toolbar
Load CSS and JavaScript Scripts and styles
Host core’s own pages in your theme Theme chrome
Let owners customise a theme with a live preview Customiser
Style the account and sign-in pages Account pages
Extend a theme without forking it Child themes
Show distance search in a theme Distance search in themes
Know which view file core picks Template hierarchy
Let core write the document head Theme head
Style the e-mails the site sends, or e-mail the site owner E-mail layout
Run slow work out of the request Background jobs
Keep a small value, flag or lock without a table Key-value store
Price a cart, add shipping, tax or discounts, hear order events Cart hooks in Billing
Keep a search filter working in saved alerts Saved-search alerts
Bring listings in from elsewhere Importing listings
Call the site from another program REST API
Post listings and comments through the API Writes
Moderate and manage a site with an admin key Admin endpoints
Get a signed POST when a listing or user changes Webhooks
Add your own REST API endpoints Plugin endpoints
Understand the schema Database model
Debug something PHP errors · SQL queries
Contribute to core Contributing

Working on core needs Composer for the PHP packages and Node for the admin theme’s CSS and JavaScript, which are built from source. Generated files are not in git.

Terminal window
git clone [email protected]:mindstellar/shopclass.git
cd shopclass
composer install
npm ci
npm run build # vendor assets + SCSS → CSS + JS
npm run watch # rebuild on change

A full stack (PHP-FPM, MariaDB, Nginx, Valkey, Mailhog and phpMyAdmin) ships in docker-compose.dev.yml:

Terminal window
npm run setup # first run: installs and builds the generated files
npm run dev:build # first run: builds the PHP-FPM image
npm run dev # start
npm run dev:logs # follow the logs

The site comes up on http://localhost:8000, with Mailhog on :8025 and phpMyAdmin on :8081. Public themes live in their own repositories, so install one into the running stack:

Terminal window
docker compose exec php-fpm php oc-cli.php market:install storefront --type=theme

The repository README has the full local-development section, including how to mount a theme or plugin you have checked out locally.

These pages are task-shaped: how to add a route, how to register a menu, what a package must declare. For tracing the code itself (what a class does, where a call ends up), Ask DeepWiki indexes the repository and answers questions about it conversationally.

It is generated from the source, so it knows the codebase and nothing about your hosting. Use it to find your way around; use these pages for how things are meant to be done.