PHP code example of eserozvataf / scabbia2-formatters

1. Go to this page and download the library: Download eserozvataf/scabbia2-formatters library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eserozvataf / scabbia2-formatters example snippets


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']);

use Scabbia\Formatters\Formatters;

$formatter = Formatters::getCurrent();

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