Private extension

Teach the calculation.
mathphp-explaining

A private extension that observes the same deterministic evaluator and turns each completed node into a useful, translatable lesson.

mathphp-explaining

Designed to load separately.

Keep mathphp/mathphp small and stable. This package adds its own contracts, translations, and presentation models without changing the public evaluator.

  • Post-order steps with dependencies
  • Substitutions, partial results, and exact spans
  • English and Danish translations
  • Custom observers without changing core semantics
Read integration notes ↗
Expression(5 × 2) × 2
  1. 1Multiply 5 by 25 × 2 = 1010
  2. 2Multiply the partial result by 210 × 2 = 2020
Final result20
// explain the same expression your app evaluates
$result = (new Explainer(Translations::create('en')))->explain('(5*2)*2');

Install from an approved source

These repositories are private and may be consumed through your organization’s Composer mirror or VCS access. Pin a tag or commit for production.

# add approved private VCS sources
composer config repositories.mathphp-visuals vcs https://github.com/mathphp/mathphp-visuals.git
composer config repositories.mathphp-explaining vcs https://github.com/mathphp/mathphp-explaining.git
composer require mathphp/mathphp-visuals:^0.1 mathphp/mathphp-explaining:^0.1
Distribution placeholder.Private repositories and commercial terms are intentionally not automated yet; the delivery model will be chosen separately.
What it adds
01

A teaching layer

Turn a single result into a sequence a learner can follow, with the operation, operands, translation key, and resulting value.

02

Translations included

Ship English or Danish copy from the same step model. Add your own catalogue without rewriting evaluation logic.

03

Stable for products

Attach observers to your UI, API, or audit log while the free core remains the source of truth.

How it fits

One core call.
One richer response.

01EvaluateCore parses and validates the expression.
02EnrichExplaining records each completed operation.
03PresentYour application chooses the UI, language, and renderer.
Feature guides