Repository navigation
Developer Guide Package Lifecycle
Developer Guide · Package structure · Runtimes
Internals: Installation, Packages, Runtime, PackageInstaller, PackageUninstaller.
Use pm install <ZIP-path-or-URL> from the AWT prompt. The installer extracts into temporary storage, locates the manifest at the archive root or one child directory, validates metadata/framework compatibility/dependencies/main.php, moves files to the package folder, creates its database record, handles data/ storage, invokes an optional hook, and emits package.installed. Temporary extraction is cleaned in finally after extraction succeeds.
Ordinary packages begin disabled. Use pm list, then pm enable <id>. New web requests and new CLI processes discover enabled records; placing files in awt_packages alone has no effect. pm disable <id> prevents execution on later startup. PackageFacade also exposes getInstalled(), getActive(), getDisabled(), getPackage(), getPackageById(), enablePackage(), disablePackage() and removePackage(); consult its reference for their distinct return values and removal behavior.
flowchart TD
A[Enabled package records] --> B[Create nonzero-type runtimes]
B --> C[Validate persisted metadata and dependency graph]
C --> D[Run dependency packages first]
D --> E[setInfo and injection]
E --> F[environmentSetup]
F --> G[Resolve environment waits]
G --> H[setup]
H --> I[Resolve setup waits]
I --> J[main]
J --> K[Capture shared, passable and router state]
K --> L[Run linked components in insertion order]
L --> M[Collect routes and handle HTTP request]
This is one complete lifecycle per runtime component, not a global setup phase for every package. There are no automatic package.started/setup/main/finished event names. Manifest dependencies run before a dependent's lifecycle. Explicit waits requested in environmentSetup run before setup; waits requested in setup run before main. A wait added during main is too late for those scheduling points.
Complete optional DemoSite/install.php:
<?php
namespace DemoSite;
use installer\interfaces\package\actions\IPostInstall;
final class Install implements IPostInstall
{
public function postInstall(int $packageId): bool
{
// Define package-owned schema using TableWizard::create($packageId).
return true;
}
}IPostUpdate::postUpdate(int $packageId): bool belongs in optional update.php. These supplied hook contracts are invoked after files/metadata/storage change. The current installer does not check their boolean return; throw an exception on failure. The legacy checked branches refer to absent package\install\interfaces\IPackageInstall and IPackageUpdate interfaces. Use the existing installer/actions contracts.
| Event | When | Bundle |
|---|---|---|
| package.installed | After installation hook returns | manifest, id |
| package.updated | After update hook returns | manifest, id |
| route.dynamic.add | When explicitly dispatched | Added routes; handled by the bootstrap listener |
| router.enter | After route security/middleware and controller creation, before action | path, action, controller |
| renderer.ready | After Blade output has been loaded into the DOM | renderer |
| context.get / vfs.context.request | When consumers request context | Mutable context request; handled by runtime-installed listeners |
See Events for event registration and payload details. There is no automatic uninstall event or uninstall.php invocation in the current uninstaller.
pm update <ZIP-path-or-URL> requires an already installed package with the same manifest name. It checks framework/dependency compatibility, moves replacement files, updates metadata (omitted optional fields keep installed values), refreshes data assets, calls update.php, and emits package.updated. It does not require a higher version. File movement replaces matching files rather than guaranteeing removal of stale files. No atomic database/filesystem rollback is provided.
pm remove <id> deletes the package model first, then attempts storage, package files, resource-cache and table cleanup, collecting errors while continuing. It can leave partial cleanup. Its docblock says records are left to callers, but the implementation deletes the record itself. Check getErrors() if using PackageUninstaller directly. Interface IUninstall exists but is not invoked by this pipeline. Removal does not enforce a reverse-dependency policy or a universal system-package guard.
Back up schema, package files and storage before updating/removing deployed packages. This is a practical recommendation based on non-atomic behavior, not an extra framework approval step. Do not promise automatic rollback, dependency downloads or hot reload to users.
AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes