Skip to content

Extension points

phil/console-bundle

The package is at 0.x: its extension points are stable only from its 1.0 release. Until then, a minor version may change them, and its CHANGELOG says how.

Ports written by the application or another package

DebugSwitch

Phil\ConsoleBundle\Application\Contract\DebugSwitch — what --debug-phil turns on. Replace the service phil_console.debug_switch to print another logger's records, or to raise the level of another logging library; tag it kernel.reset when it keeps what it enabled.

MethodContract
channels(): list<string>The channels it knows, in order
enable(list<string> $channels, OutputInterface $output): voidWrites the records of those channels to the output; skips the unknown ones
disable(): voidUndoes enable(); does nothing when nothing is enabled
services:
    phil_console.debug_switch:
        class: App\Console\AuditLogSwitch
        tags: [kernel.reset]

MemoryGauge

Phil\ConsoleBundle\Application\Contract\MemoryGauge — the memory of the summary. Replace the service phil_console.memory_gauge.

MethodContract
usage(): intThe bytes in use now
peak(): intThe highest bytes in use

Services

ServiceRole
phil_console.clockThe Psr\Clock\ClockInterface of the timestamps and the summary; replace it with the application's clock
Phil\ConsoleBundle\Infrastructure\Console\CommandGuardReaderThe guards of a command, for a tool of the application
Phil\ConsoleBundle\Application\EnvironmentGuardHolds a command to its guards in the kernel's environment
services:
    phil_console.clock: '@clock'

Events

The bundle dispatches no event of its own. A refusal is an EnvironmentRefused exception, which the console dispatches with console.error; a listener of that event can log it or alert on it.

Exceptions

ExceptionWhen
Phil\ConsoleBundle\Domain\Exception\EnvironmentRefusedA command forbidden, not confirmed, or not interactive where a confirmation is needed; code 77
Phil\ConsoleBundle\Domain\Exception\InvalidGuardAn attribute without the environment it needs, or with an empty name

Both implement Phil\ConsoleBundle\Domain\Exception\ConsoleException.