Skip to content

Extension API Versioning

Every Capell package declares the Capell API range it supports. This page explains what that declaration means, what Capell guarantees inside it, and how to tell whether a Capell release will break your package.

capell.json requires capellApiVersion, a Composer semver constraint — not a fixed version:

{
"capellApiVersion": "^1.0"
}

Capell compares its own extension API version against your constraint with Composer\Semver\Semver::satisfies(). The current value is published as a constant:

Capell\Core\Support\Extensions\CapellExtensionApi::CURRENT_VERSION; // '1.1.0'

This is the extension API version. It is deliberately separate from the Capell release version and from any package’s own version, so the two can move independently: a Capell release that adds no extension surfaces does not bump it.

^1.0 accepts every 1.x extension API, including minor releases that may contain documented breaks. Choose a constraint matching the versions your package has tested, and review each release before widening it. An exact constraint such as "1.1.0" also excludes compatible later releases; use a bounded range when that better reflects your compatibility testing.

The base manifest validator only requires capellApiVersion to be a non-empty string. The constraint is actually evaluated in two places:

CheckBehaviour on mismatch
php artisan capell:extension-auditReports “Manifest capellApiVersion does not allow the current Capell API.”
php artisan capell:upgrade --dry-runReports a finding for an empty or non-satisfying constraint before the upgrade runs

So an incompatible constraint surfaces at audit and upgrade-planning time, not at boot. A package whose constraint excludes the running Capell is not silently disabled — run the audit to find out.

Individual contributions narrow this further. public static function compatibleCapellApiVersion(): string is an abstract member of the ExtensionContribution contract, so every class listed in contributes[] must define it, and the audit checks each one against the running API in addition to the manifest-level constraint. A contribution can therefore declare a tighter range than the package as a whole.

The extension API version tracks the stable extension surfaces — the registries, contracts, and manifest requirements a package is allowed to build on. It does not cover internal Capell classes, which may change in any release.

Two generated files in this directory define the surface:

  • extension-surface-catalog.json — every extension surface, each marked with a stability level. Generated by scripts/build-extension-surface-catalog.php and contract-tested. Verify it is current with:

    Terminal window
    composer check:extension-surfaces

    The Composer script passes --check, which only verifies. Run the script without that flag to rewrite the catalogue.

  • stable-extension-api-baseline.json — a frozen snapshot of the surfaces marked stable, including a reflection hash of every public method signature, plus core’s Composer requirements, migrations, and config keys. Verify with:

    Terminal window
    composer check:stable-extension-api

The baseline check rebuilds the snapshot from current code and diffs it against the committed file. Drift is reported as removed class: X or changed public signature: X, and also as a bare section name — manifestRequirements, packageConstraints, migrations, or configKeys — so adding a core migration or changing a core Composer constraint counts as drift too.

Drift only passes with an explicit compatibility decision record in stable-extension-api-decision.json whose drift entries match the detected drift exactly. Running the script without --check does rewrite the baseline, so the guarantee ultimately rests on reviewing the committed baseline diff rather than on the script alone.

A stable surface does not lose a class or change a public signature without a recorded, reviewed compatibility decision.

Removing a stable API follows a fixed notice period:

  1. Deprecate first. The surface is marked @deprecated (naming the replacement) and listed in the release notes of a minor release. It keeps working unchanged.
  2. Keep it for at least one minor release. A stable API is never removed in the same release that deprecates it.
  3. Remove only in the next major. Removal of a stable class, method, property, constant or configuration key ships only in a new major release, with migration guidance in its release notes.

Additive changes and fixes need no deprecation. A behavioural or signature break to a stable surface that cannot follow this path is not permitted within a major line. Experimental and internal surfaces are outside this commitment. A broad constraint such as ^1.0 still accepts a 1.x API minor containing a break: the constraint check alone cannot establish behavioural compatibility. Read the Breaking section and test against the target release before upgrading.

Checking Your Package Against A Capell Release

Section titled “Checking Your Package Against A Capell Release”

Before supporting a new Capell version:

Terminal window
php artisan capell:extension-audit path/to/your-package
php artisan capell:upgrade --dry-run

The audit validates the manifest against the v3 contract and checks the API constraint. It exits non-zero when any result has severity error. The upgrade dry run reports version findings across every installed package without changing anything.

Neither command verifies that your package still behaves correctly. Run your own suite against the target Capell release as well — see Testing packages.

  • Patch — fixes that do not break behaviour or contracts.
  • Minor — additive changes and deprecations. Experimental surfaces may change with a Breaking release-notes section, a reviewed compatibility decision, migration guidance and an extension API version bump. Stable surfaces are never removed in a minor release; see Deprecation and removal.
  • Major — a new compatibility line; the only release that removes deprecated stable surfaces. Its release notes describe migration and supported versions.

The Capell release version and extension API version are separate. Bump the extension API version when an extension contract or its behaviour changes, including a break; document the affected surfaces and migration. Do not assume a semver constraint alone rejects an incompatible minor.

The catalogue is the source of truth for stability. Class-backed stable surfaces carry @api, experimental surfaces carry @experimental, and internal surfaces carry @internal. Experimental surfaces remain available for experimentation but may change without the stable-surface guarantees. A method, property or constant on any class may also carry @internal. Non-class surfaces such as hooks and configuration keys are classified in the catalogue rather than PHPDoc.

Package authors using PHPStan can opt in to the class-use rule by including the file shipped with Core in their own phpstan.neon:

includes:
- vendor/capell-app/core/extension-phpstan.neon

When using the foundation aggregate instead of the split Core package, use vendor/capell-app/capell/packages/core/extension-phpstan.neon. Install PHPStan separately in the consuming project. The rules report references to Capell classes marked @experimental or @internal as capell.internalClass, and use of @internal methods, properties and constants as capell.internalMember; non-class surfaces are not inspected. They also report capell.cacheNumericRead where code expects a number read from the cache to be an int or float, through is_int(), is_float() or an int or float return type: the Redis store, which Valkey uses, returns stored numbers as numeric strings. Normalise the value first, for example is_numeric($value) ? (int) $value : $default. Existing packages are not blocked at runtime, and this rule is opt-in so adoption can be managed by each package. PHPStan’s own internal-API checks may still report @internal uses independently.

Foundation linePHPLaravelSecurity support
1.x current release8.4+13.xWhile 1.x is current, and at least 12 months after the next major release.
Earlier 1.x minorsSee the release’s Composer constraints.See the release’s Composer constraints.At least 24 months from each minor’s release.

The latest 1.x minor also retains its existing 24-month commitment. The 1.x end-of-life date depends on the next major’s release date and will be published when that date is known. The security policy in SECURITY.md governs vulnerability reporting and support.