Repository navigation
Internals Package Dependency Dependency
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/package/dependency/Dependency.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.
readonly class DependencyDeclarations 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 |
|---|---|---|
| Constructor-promoted | public function __construct(public string $name |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public string $version = '*' |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | public string $url = '') |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct(public string $name, public string $version = '*', public string $url = '') |
| fromArray | public static function fromArray(array $data): static |
| matchesVersion | public static function matchesVersion(string $version, string $constraint): bool |
public function __construct(public string $name, public string $version = '*', public string $url = '');| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$name |
public string $name |
Named key/label selected by this API; its exact scope is shown by the implementation trace. |
$version |
public string $version = '*' |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$url |
public string $url = '' |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
public static function fromArray(array $data): static| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$data |
array $data |
Input data array or payload; see allowed fields and validation guards below. |
Return expressions (including local callbacks): new static($data['name'], $version, $url).
Explicit exceptions: \InvalidArgumentException. 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 static function fromArray(array $data): static
{
if (!isset($data['name']) || !is_string($data['name']) || trim($data['name']) === '') {
throw new \InvalidArgumentException('Dependencies must specify a package name.');
}
$version = $data['version'] ?? '*';
$url = $data['url'] ?? '';
if (!is_string($version) || !is_string($url)) throw new \InvalidArgumentException('Dependency version and url must be strings.');
self::matchesVersion('0.0.0', $version); // Validate even before the dependency is installed.
return new static($data['name'], $version, $url);
}public static function matchesVersion(string $version, string $constraint): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$version |
string $version |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$constraint |
string $constraint |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Exact versions, *, and whitespace-separated comparisons (logical AND).
Return expressions (including local callbacks): true; $matches.
Explicit exceptions: \InvalidArgumentException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
/** Exact versions, *, and whitespace-separated comparisons (logical AND). */
public static function matchesVersion(string $version, string $constraint): bool
{
if ($constraint === '*') return true;
$matches = true;
foreach (preg_split('/\s+/', trim($constraint)) as $part) {
if (!preg_match('/^(>=|<=|>|<|==|=|!=)?(\d+(?:\.\d+){0,2}(?:-[0-9A-Za-z.-]+)?)$/', $part, $match)) {
throw new \InvalidArgumentException("Unsupported dependency version constraint: {$constraint}");
}
$matches = version_compare($version, $match[2], ($match[1] ?? '') ?: '==') && $matches;
}
return $matches;
}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