Extension Lifecycle
Use this when a package should be discovered, audited, installed, enabled, and surfaced by Capell without patching host package code.
The lifecycle has four parts:
- Composer makes the package classes available.
capell.jsondescribes the extension contract.- Install providers and commands prepare database/config state.
- Runtime/admin/frontend providers load only when the extension is enabled.
Uninstalling an extension also removes any published schema migration files that match files in the extension’s database/migrations directory. To run that cleanup directly, use php artisan capell:delete-migrations vendor/example, or php artisan capell:delete-migrations --all for every registered Capell package.
Minimum Files
Section titled “Minimum Files”packages/example├── composer.json├── capell.json├── src/Providers/ExampleInstallServiceProvider.php├── src/Providers/ExampleServiceProvider.php└── testsAdd admin, frontend, migrations, settings, translations, and docs only when the package needs them.
Composer Metadata
Section titled “Composer Metadata”Composer discovery should make provider classes available. Capell decides when each provider bucket is loaded.
{ "name": "vendor/example", "type": "library", "autoload": { "psr-4": { "Vendor\\Example\\": "src" } }, "extra": { "laravel": { "providers": [ "Vendor\\Example\\Providers\\ExampleMetadataServiceProvider" ] } }}Keep the Composer-discovered provider safe. It can publish metadata, but it should not register runtime behaviour that depends on the extension being enabled.
Manifest Shape
Section titled “Manifest Shape”capell.json uses manifest version 3. The validator rejects v1/v2 fields such as capell-version.
{ "manifest-version": 3, "name": "vendor/example", "slug": "example", "displayName": "Example", "kind": "package", "visibility": "catalogue", "capellApiVersion": "^1.0", "version": "1.0.0", "description": "Example extension for Capell.", "product": { "group": "Capell Foundation", "tier": "free" }, "namespace": "Vendor\\Example\\", "surfaces": ["admin", "frontend", "console"], "dependencies": { "requires": ["capell-app/core"], "supports": ["capell-app/admin", "capell-app/frontend"], "conflicts": [] }, "providers": { "metadata": [ "Vendor\\Example\\Providers\\ExampleMetadataServiceProvider" ], "install": [ "Vendor\\Example\\Providers\\ExampleInstallServiceProvider" ], "runtime": ["Vendor\\Example\\Providers\\ExampleServiceProvider"], "admin": ["Vendor\\Example\\Providers\\ExampleAdminServiceProvider"], "frontend": [ "Vendor\\Example\\Providers\\ExampleFrontendServiceProvider" ] }, "contributes": [], "contributionTraceability": {}, "database": { "migrations": true, "settings": false, "requiredTables": [] }, "commands": { "install": "capell:example-install", "setup": null, "setupParams": [], "demo": null, "demoParams": [], "health": null }, "settings": [], "permissions": [], "capabilities": [], "performance": { "frontendRenderBudgetMs": 50, "adminQueryBudget": 25, "cacheTags": [], "cacheSafety": { "cacheable": false, "sensitiveOutput": false, "queueInvalidation": false, "variesBy": [], "invalidationSources": [] } }, "healthChecks": [], "commercial": { "privateDocsRequested": false }, "marketplace": { "summary": "Adds an example extension surface.", "categories": ["example"], "screenshots": [] }}visibility defaults to catalogue. Set it to support for dependency-only packages such as theme admin/core helpers. Support packages are hidden from normal package selection, but they remain installable when a visible package lists them in dependencies.supports.
Provider buckets must all exist, even when some lists are empty. Provider classes must be inside the package PSR-4 namespace and must extend Laravel’s ServiceProvider.
Provider Buckets
Section titled “Provider Buckets”| Bucket | Loads when | Allowed work |
|---|---|---|
metadata | The package is discovered | Safe metadata only. Do not register runtime routes, resources, views, or listeners here. |
install | Installer or extension install workflow runs | Install commands, migration publishing, setup helpers, one-off checks. |
runtime | Extension is enabled | Shared runtime services, models, policies, events, package config. |
admin | Extension is enabled and admin/console runtime is active | Filament resources, admin bridges, widgets, settings schemas, admin routes. |
frontend | Extension is enabled and frontend runtime is active | Render hooks, frontend components, frontend routes, Tailwind assets, cache dependencies. |
The separation matters. Admin code should not load on public frontend requests, and install-only wiring should not stay active after setup.
Contributions
Section titled “Contributions”Use contributes when a package exposes contract-backed capabilities that Capell can audit.
{ "type": "admin-resource", "class": "Vendor\\Example\\Extensions\\ExampleAdminResourceContribution"}Each contribution class must implement the contract expected by its type. Current contribution types include:
admin-resourceadmin-pageadmin-action-extendersectionpage-typepage-variationdashboard-widgetbuilder-blockoverview-statschema-extenderconfiguratormodelpermissionroutesettingfrontend-componentrender-hookassetmigrationscheduled-jobconsole-commandagent-capabilityhealth-checkworkflow-attention
Use existing package extension points directly when the package only needs a small local hook. Use manifest contributions when the package should be auditable by Capell tooling.
Audit Before Install
Section titled “Audit Before Install”Run the audit before wiring a package into an app:
php artisan capell:extension-audit packages/examplephp artisan capell:extension-audit packages/example/capell.jsonThe audit checks the manifest shape, provider buckets, class namespaces, contribution contracts, cache-safety metadata, health checks, and Marketplace metadata.
Install Flow
Section titled “Install Flow”Once Composer has installed the package:
php artisan capell:package-cache:clearphp artisan capell:package-cachephp artisan capell:extension-install vendor/example --dry-runphp artisan capell:extension-install vendor/exampleUse --dry-run first on a new package. Use package-scoped params when the extension declares install parameters:
php artisan capell:extension-install vendor/example \ --url=https://example.test \ --languages=en \ --sites=Main \ --param=vendor/example:seedDemo=trueInstall verification
Section titled “Install verification”Before Capell installs or enables a non-foundation extension, it checks the installed Composer metadata and capell.json without loading the declared classes. It checks identity, manifest structure, autoload paths and declared class files, and refuses Composer plugins by default. When a caller supplies an expected version, previous version, slug or distribution checksum, it also checks those values. A supplied release checksum is compared with Composer’s recorded dist.shasum, which Composer verified against downloaded archive bytes. It does not detect post-install changes; source installs lack this digest and fail when a checksum is required, so strict checksum verification requires dist archives. A checksum for a different release is reported as a warning and is not compared. These checks reduce accidental or unexpected package activation; they do not establish that package code is safe. Composer may already have executed code before this check.
Marketplace releases may also supply release_content_sha256 for the release named by release_checksum_version. After the distribution checksum gate passes, Capell compares this value with the installed package directory. Omit it for releases that do not publish a content hash. A hash for another version is reported as a warning and is not compared. Generate the value from the exact release tree using php artisan capell:extensions:hash <path>.
The content hash is SHA-256 over one record per regular file, ordered by its relative path as binary strings. Paths use / separators and include no leading slash. Each record is the decimal byte length of the relative path, a colon, the path, a colon, the lowercase hexadecimal SHA-256 of the file bytes, and a newline. Empty directories and file metadata such as mtime are ignored. Entries named .git, .hg, and .svn are excluded at every depth. Composer’s installed metadata and generated autoload files live outside the package directory and are therefore not included; no package files are excluded as Composer rewrites. Symbolic links and non-regular files cause hashing to fail. The algorithm streams file contents and sorts one directory at a time.
When a Marketplace install or update fails verification for the extension or for any package the operation added or changed in composer.lock, Capell quarantines that whole changed set, names the failing package and the set in the failure message, and rolls the Composer state back. A completed rollback lifts the quarantine; a failed rollback leaves every package in the set quarantined. A quarantined package is never enabled or booted, whatever the strict setting, and doctor lists it with the failing package. After resolving the cause, run php artisan capell:extensions:release-quarantine <package>; it releases the package only if it verifies at that moment.
CAPELL_EXTENSION_VERIFICATION_STRICT=true is the default: a failure stops activation. With false, local install and enable paths log the package name and failure codes and continue; doctor still reports warnings. Marketplace operations always fail on verification errors. CAPELL_EXTENSION_ALLOW_COMPOSER_PLUGINS=false rejects packages declaring a Composer plugin; set it to true only after reviewing the plugin and Composer’s own plugin policy. Doctor checks installed extensions regardless of the strict setting.
In the CLI, a refusal reports the package, the first failure and the next action. In Admin, the installation failure reports the same reason and next action; ask the server administrator or extension author to correct it before retrying. A failed install is recorded as failed; an enable refusal leaves the existing state in place.
| Failure code | Author or administrator action |
|---|---|
not_installed | Install the intended Composer package and retry. |
version_outside_constraint | Install a release matching the requested constraint. |
not_an_upgrade | Select a release newer than the previous version. |
composer_plugin | Remove the plugin declaration or have the administrator review and explicitly allow it. |
manifest_missing | Include capell.json in the distributed package and reinstall it. |
manifest_invalid | Correct the manifest against the version 3 contract and reinstall it. |
manifest_identity_mismatch | Make the manifest name and requested slug match the intended extension. |
autoload_escapes_package | Point every autoload entry to an existing path inside the package. |
provider_file_missing | Include the declared provider, contribution or health-check class at its PSR-4 path. |
checksum_missing | Supply the expected distribution checksum through a trusted package source. |
content_hash_mismatch | Obtain the intended release from a trusted source and resolve the content mismatch. |
content_hash_unreadable | Check that the package contains readable regular files and no symbolic links. |
checksum_mismatch | Obtain the intended distribution from a trusted source and resolve the checksum mismatch before retrying. |
Uninstall Flow
Section titled “Uninstall Flow”Uninstall keeps extension-owned data by default so the package can be reinstalled later with its previous state intact:
php artisan capell:extension-uninstall vendor/example --dry-runphp artisan capell:extension-uninstall vendor/exampleIf the admin intentionally wants to remove extension-owned data, pass --delete-data. If the Composer package should also be removed, pass --delete-package; this deletes extension-owned data before running Composer removal.
Packages that own tables or other persistent state can implement Capell\Core\Contracts\Extensions\DeletesExtensionData on their service provider or a manifest provider class. Capell calls deleteExtensionData(PackageData $package) only when the admin chooses data deletion or deletes the package.
Runtime Rules
Section titled “Runtime Rules”- Optional packages must not register runtime providers until enabled.
- Package writes belong in Actions, not resource classes or controllers.
- User-facing strings belong in package translations.
- Public frontend output must not include authoring markers, model IDs, field paths, package internals, permissions, or signed admin URLs.
- Cacheable frontend output needs invalidation metadata in the manifest or explicit cache invalidation registration.
Serving Events
Section titled “Serving Events”Use the serving callbacks when registration depends on Capell’s own boot sequence:
use Capell\Admin\Facades\CapellAdmin;use Capell\Core\Facades\CapellCore;
CapellCore::serving(function (): void { // Register Core runtime extensions here.});
CapellAdmin::serving(function (): void { // Register Filament/admin extensions here.});CapellCore::serving(...) listens for Capell\Core\Events\ServingCapell, which is
dispatched once Core has registered its built-in assets and discoverable components.
CapellAdmin::serving(...) listens for Capell\Admin\Events\ServingAdmin, which is
dispatched from Filament’s serving callback and therefore only runs when the admin panel
is serving.
Keep ordinary container bindings and configuration in the package service provider. Use these callbacks for extension registration that must happen after the corresponding Core or Admin surface is ready. There is no frontend serving event; frontend packages register through their enabled frontend provider and the frontend extension points.