Repository navigation
Internals Vfs Resource PublicResource
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/vfs/resource/PublicResource.php · Snapshot 8411f4287706.
VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.
final class PublicResourceSource description (behavioral corrections are recorded in Known discrepancies):
HTTP access policy; internal Resource lookup intentionally includes framework source files.
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 |
|---|---|---|
| const EXTENSIONS | private const EXTENSIONS = ['json', 'txt', 'xml', 'html', 'htm', 'css', 'js', 'mjs', 'png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'ico', 'bmp', 'avif', 'tiff', 'mp4', 'webm', 'ogv', 'mov', 'mp3', 'wav', 'ogg', 'oga', 'aac', 'flac', 'm4a', 'weba', 'woff', 'woff2', 'ttf', 'otf', 'eot', 'pdf']; |
State or definition consumed by the methods below; reads and writes are preserved in their implementation traces. |
| const DIRECTORIES | private const DIRECTORIES = ['assets', 'public', 'views/assets', 'data', 'css', 'js', 'images', 'fonts', 'videos', 'audio']; |
State or definition consumed by the methods below; reads and writes are preserved in their implementation traces. |
| Method | Signature |
|---|---|
| allows | public static function allows(string $package, string $path, string $root = PACKAGES): bool |
public static function allows(string $package, string $path, string $root = PACKAGES): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$package |
string $package |
Package identifier or InstalledPackage metadata as indicated by the declared type. |
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
$root |
string $root = PACKAGES |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): false; true.
Implementation, validation guards and interaction order
public static function allows(string $package, string $path, string $root = PACKAGES): bool
{
$directory = realpath(rtrim($root, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $package);
$file = realpath($path);
if ($directory === false || $file === false || !is_file($file) || !is_readable($file)
|| !str_starts_with($file, $directory . DIRECTORY_SEPARATOR)) return false;
$relative = str_replace(DIRECTORY_SEPARATOR, '/', substr($file, strlen($directory) + 1));
foreach (explode('/', $relative) as $segment) if (str_starts_with($segment, '.')) return false;
if (!in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), self::EXTENSIONS, true)) return false;
foreach (self::DIRECTORIES as $allowed) {
if (str_starts_with($relative, $allowed . '/')) return true;
}
return false;
}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