, (*1)
💥 Oh Snap!
A pretty formatter for BooBoo., (*2)
, (*3)
Installation
It is recommended that you install this library using Composer., (*4)
composer require mzdr/oh-snap
Don’t forget to check out the official documentation of BooBoo on how to use and install it., (*5)
, (*6)
Usage
```php
['default'],
// Path to custom template file.
'template' => null,
// If set to true, code preview will not contain the
// whole file but the amount of lines defined in excerptSize.
'excerptOnly' => false,
// Amount of lines the code preview should have…
'excerptSize' => 20,
// Optional header/footer content to show. May be a path
// to a file that should be required. Output will not be
// sanitized in any way.
'header' => null,
'footer' => null
];
$booboo = new BooBoo([new PrettyFormatter($options)]);
$booboo->register();
throw new RuntimeException('Oh snap! 🙈');
```
## Customizing
You may customize the formatter in **3** different ways.
, (*7)
If you want **full** control over the output of the formatter, you’ll probably need to use a custom template. This is preferably a `.php` file since it’s going to be `require()'d` and it’s output will be returned to BooBoo.
Just keep in mind, if you do so, you are going to start from scratch. Check out the [default template] for inspiration. 🌟
If you just want to **repaint** the default template this is the way to go. You either can use a completely new CSS file _or_ append one.
```php
['default', 'path/to/your.css', 'a { color: pink; }'],
// Using different stylesheet…
'theme' => ['path/to/your.css'],
// Using no styles at all? ¯\_(ツ)_/¯
'theme' => [],
];
```
Maybe the `header` and/or `footer` options are just enough? They will be placed inside the respective elements (e.g. ``) of the
default template,
or your custom template
if you implement it. You may pass
any string you like, including HTML. Perfect for just a little branding.
, (*8)
License
This project is licensed under MIT license., (*9)