Repository navigation
Internals Response Senders PdfSender
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/response/senders/PdfSender.php · Snapshot 8411f4287706.
Response builds status, headers and data/file payloads, chooses a MIME sender, and emits HTTP output. JSON arrays are wrapped in a status/message/data envelope.
class PdfSender extends AbstractSenderNo own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.
| Method | Signature |
|---|---|
| supportedMimes | public function supportedMimes(): array |
| send | public function send(mixed $payload, int $status, array $headers): void |
public function supportedMimes(): arrayReturn expressions (including local callbacks): ['application/pdf'].
Implementation, validation guards and interaction order
public function supportedMimes(): array
{
return ['application/pdf'];
}public function send(mixed $payload, int $status, array $headers): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$payload |
mixed $payload |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$status |
int $status |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$headers |
array $headers |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$payload must be a file path. Pass header 'Content-Disposition: attachment; filename="file.pdf"' via $headers if you want a forced download rather than inline view.
External effects include header.
Implementation, validation guards and interaction order
/**
* $payload must be a file path.
* Pass header 'Content-Disposition: attachment; filename="file.pdf"'
* via $headers if you want a forced download rather than inline view.
*/
public function send(mixed $payload, int $status, array $headers): void
{
$path = (string) $payload;
$this->requireReadable($path);
$size = $this->fileSize($path);
$this->emitStatus($status);
$this->emitContentType('application/pdf');
header("Content-Length: $size");
// Default to inline viewing unless the caller sets Content-Disposition.
if (!isset($headers['Content-Disposition'])) {
$filename = basename($path);
header("Content-Disposition: inline; filename=\"$filename\"");
}
$this->emitHeaders($headers);
$this->streamFile($path);
}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