Composed Extensions
Composition lets one extension own child extensions. A registered parent's contains option is an allowlist of direct child types. Register the types before kernel discovery.
use JobMetric\Extension\Facades\ExtensionTypeRegistry;
ExtensionTypeRegistry::register('Component', ['contains' => ['Module']]);
ExtensionTypeRegistry::register('Module');
Declare the Children
Add the child descriptors to the parent manifest:
{
"extension": "Component",
"name": "Shop",
"title": "Shop",
"version": "1.0.0",
"multiple": false,
"children": [{"type": "Module", "name": "LatestProducts"}]
}
The child lives in Component/Shop/Extensions/Module/LatestProducts and has its own LatestProducts.php and extension.json. Its namespace includes the enclosing Shop extension.
Install and Upgrade
Install, uninstall, delete, or upgrade the root. Direct child lifecycle operations are rejected. Installations validate identity, ownership, dependencies, and cycles. Upgrades via upgradeComposition() require unchanged membership.
Migrations can execute outside the metadata transaction, so a failure may require schema or side-effect recovery before retrying. Keep snapshots and operation-lock storage shared on multi-node deployments. Activation policy, archive validation, and file promotion belong to the host application.
When looking up a child by type and name, pass its owner to the Extension service. Prefer IDs when operating on an existing plugin instance.