# OutputWriter

> Writes service messages to standard output or standard error, appending one newline per message.

[API reference](/docs/api/index.md) › [Scaffold](/docs/extensions/scaffold/reference/index.md) › [Console](/docs/extensions/scaffold/reference/console/index.md) › OutputWriter

| interface | `PHPForge\Scaffold\Console\OutputWriter` |
| --- | --- |
| Source | [`src/Console/OutputWriter.php`](https://github.com/php-forge/scaffold/blob/main/src/Console/OutputWriter.php#L10) |

Implemented by 2 types:

- [`ComposerIoWriter`](/docs/extensions/scaffold/reference/console/composeriowriter/index.md)
- [`SymfonyOutputWriter`](/docs/extensions/scaffold/reference/console/symfonyoutputwriter/index.md)

Writes service messages to standard output or standard error, appending one newline per message.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`writeStderr()`](#method-writeStderr) abstract | Writes `$message` to the standard error stream followed by a trailing newline. | `OutputWriter` |
| [`writeStdout()`](#method-writeStdout) abstract | Writes `$message` to the standard output stream followed by a trailing newline. | `OutputWriter` |

## Method details

### writeStderr() <span id="method-writeStderr"></span>

```php
abstract public function writeStderr(string $message): void
```

Writes `$message` to the standard error stream followed by a trailing newline.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$message` | `string` | Message without a trailing newline; the writer appends one. |

### writeStdout() <span id="method-writeStdout"></span>

```php
abstract public function writeStdout(string $message): void
```

Writes `$message` to the standard output stream followed by a trailing newline.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$message` | `string` | Message without a trailing newline; the writer appends one. |