Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

eser/scabbia2-formatters

Repository files navigation

Scabbia2 Formatters Component

This component is a simple abstraction layer which helps scabbia2 to generate output in various formats such as Html, Console and etc. New formatters can be derived by implementing Scabbia\Formatters\FormatterInterface interface.

Build Status Scrutinizer Code Quality Total Downloads Latest Stable Version Latest Unstable Version Documentation Status

Usage

Formatters

use Scabbia\Formatters\ConsoleFormatter;
use Scabbia\Formatters\HtmlFormatter;

if (PHP_SAPI === "cli") {
    $formatter = new ConsoleFormatter();
} else {
    $formatter = new HtmlFormatter();
}

$formatter->writeHeader(2, 'Heading');
$formatter->writeColor('red', 'important text');
$formatter->write('normal text');
$formatter->writeArray(['array', 'output']);

Auto-selecting Formatter

use Scabbia\Formatters\Formatters;

$formatter = Formatters::getCurrent();

$formatter->write('an adaptive output');

Links

Contributing

It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome. All contributions should be filed on the eserozvataf/scabbia2-formatters repository.

  • To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
  • To report a bug: If something does not work, please report it using GitHub issues.
  • To support: Donate

About

Scabbia2 Formatters Component

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages