Repository navigation
Internals Package Facade PackageFacade
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/package/facade/PackageFacade.php · Snapshot 8411f4287706.
Package metadata is persisted in awt_package. Manifest readers validate input and package services build installed models; startup executes enabled nonzero-type packages.
use package\model\InstalledPackage;
use package\model\repository\interfaces\IPackageRepository;
use package\model\repository\PackageRepository;
use package\model\service\interface\IPackageService;
use package\model\service\PackageService;class PackageFacadeSource description (behavioral corrections are recorded in Known discrepancies):
PackageFacade
Handles installed package database operations.
Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.
| Member | Declaration | Purpose or source contract |
|---|---|---|
| $repository | private IPackageRepository $repository; |
Used by __construct(), getRepository(). |
| $service | private IPackageService $service; |
Used by __construct(), getService(), getPackage(), getPackageById(), getInstalled(), enablePackage(), disablePackage(), getActive(), getDisabled(). |
| Constructor-promoted | public function __construct(?IPackageRepository $repository = null) |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct(?IPackageRepository $repository = null) |
| getService | public function getService(): IPackageService |
| getRepository | public function getRepository(): IPackageRepository |
| getPackage | public function getPackage(string $name): ?InstalledPackage |
| getPackageById | public function getPackageById(int $id): InstalledPackage |
| getInstalled | public function getInstalled(): array |
| enablePackage | public function enablePackage(int $id): void |
| disablePackage | public function disablePackage(int $id): void |
| removePackage | public function removePackage(int $id, bool $purge = false): void |
| getActive | public function getActive(): array |
| getDisabled | public function getDisabled(): array |
public function __construct(?IPackageRepository $repository = null)| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$repository |
?IPackageRepository $repository = null |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->repository, $this->service.
Implementation, validation guards and interaction order
public function __construct(?IPackageRepository $repository = null)
{
$this->repository = $repository ?? new PackageRepository();
$this->service = new PackageService($this->repository);
}public function getService(): IPackageServiceReturn expressions (including local callbacks): $this->service.
Implementation, validation guards and interaction order
public function getService(): IPackageService
{
return $this->service;
}public function getRepository(): IPackageRepositoryReturn expressions (including local callbacks): $this->repository.
Implementation, validation guards and interaction order
public function getRepository(): IPackageRepository
{
return $this->repository;
}public function getPackage(string $name): ?InstalledPackage| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$name |
string $name |
Named key/label selected by this API; its exact scope is shown by the implementation trace. |
Return expressions (including local callbacks): $this->service->getPackage($name).
Implementation, validation guards and interaction order
public function getPackage(string $name): ?InstalledPackage
{
return $this->service->getPackage($name);
}public function getPackageById(int $id): InstalledPackage| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
Return expressions (including local callbacks): $this->service->getPackageById($id) ?? throw new \OutOfBoundsException("Package with ID {$id} not found.").
Explicit exceptions: \OutOfBoundsException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
public function getPackageById(int $id): InstalledPackage
{
return $this->service->getPackageById($id) ?? throw new \OutOfBoundsException("Package with ID {$id} not found.");
}public function getInstalled(): arrayReturn expressions (including local callbacks): $this->service->getInstalled().
Implementation, validation guards and interaction order
public function getInstalled(): array { return $this->service->getInstalled(); }public function enablePackage(int $id): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
Computes or delegates the operation shown below; no explicit receiver property assignment or throw occurs in this method.
Implementation, validation guards and interaction order
public function enablePackage(int $id): void { $this->service->enablePackage($id); }public function disablePackage(int $id): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
Computes or delegates the operation shown below; no explicit receiver property assignment or throw occurs in this method.
Implementation, validation guards and interaction order
public function disablePackage(int $id): void { $this->service->disablePackage($id); }public function removePackage(int $id, bool $purge = false): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
$purge |
bool $purge = false |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Remove code and resource records; purge also removes owned storage and tables.
Explicit exceptions: \RuntimeException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
/** Remove code and resource records; purge also removes owned storage and tables. */
public function removePackage(int $id, bool $purge = false): void
{
$steps = $purge ? null : [
new \uninstaller\cleanup\PackageFilesCleanup(PACKAGES),
new \uninstaller\cleanup\ResourceCleanup(PACKAGES),
];
$uninstaller = new \uninstaller\PackageUninstaller($steps, $this);
if (!$uninstaller->uninstall($id)) {
throw new \RuntimeException(implode("\n", $uninstaller->getErrors()));
}
}public function getActive(): arrayReturn expressions (including local callbacks): $this->service->getActive().
Implementation, validation guards and interaction order
public function getActive(): array
{
return $this->service->getActive();
}public function getDisabled(): arrayReturn expressions (including local callbacks): $this->service->getDisabled().
Implementation, validation guards and interaction order
public function getDisabled(): array
{
return $this->service->getDisabled();
}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