Attention needed

Saeghe is a difficult name to pronounce. Therefore, Saeghe project has been renamed to phpkg.

This website no longer receives updates.

Please visit phpkg website at phpkg.com

Write Library

This document describes included functions in the Saeghe\Cli\IO\Write library.

line

function line(string $string): void

Description

Print the given string directly in the stdout with the default font color.

Usages

use function Saeghe\Cli\IO\Write\line;

line('Hello World!');
use Saeghe\Cli\IO\Write;

Write\line('Hello World!');

Examples

line('Hello World!'); // Output => Hello World! 

assert_line

function assert_line(string $expected, string $actual): bool

Description

Assert to see the expected string has been printed using the line function and resulted in the actual output.

Usages

use function Saeghe\Cli\IO\Write\assert_line;

$output = shell_exec('command');
assert_line($expected, $output);
use Saeghe\Cli\IO\Write;

$output = shell_exec('command');
Write\assert_line($expected, $output);

success

function success(string $string): void

Description

Print the given string directly in the stdout with green font color.

Usages

use function Saeghe\Cli\IO\Write\success;

success('Hello World!');
use Saeghe\Cli\IO\Write;

Write\success('Hello World!');

Examples

success('Hello World!'); // Output(With a green font color) => Hello World!

assert_success

function assert_success(string $expected, string $actual): bool

Description

Assert to see the expected string has been printed using the success function and resulted in the actual output.

Usages

use function Saeghe\Cli\IO\Write\assert_success;

$output = shell_exec('command');
assert_success($expected, $output);
use Saeghe\Cli\IO\Write;

$output = shell_exec('command');
Write\assert_success($expected, $output);

error

function error(string $string): void

Description

Print the given string directly in the stdout with red font color.

Usages

use function Saeghe\Cli\IO\Write\error;

error('Hello World!');
use Saeghe\Cli\IO\Write;

Write\error('Hello World!');

Examples

error('Hello World!'); // Output(With a red font color) => Hello World!

assert_error

function assert_error(string $expected, string $actual): bool

Description

Assert to see the expected string has been printed using the error function and resulted in the actual output.

Usages

use function Saeghe\Cli\IO\Write\assert_error;

$output = shell_exec('command');
assert_error($expected, $output);
use Saeghe\Cli\IO\Write;

$output = shell_exec('command');
Write\assert_error($expected, $output);