Facade
If you’re manually highlighting code with Phiki, you can replace the usage ofPhiki\Phiki with a facade.
Registering custom extensions
If you wish to register a custom extension, you can do so in theboot method of a service provider.
Registering custom grammars and themes
If you wish to register a custom grammar or theme in a Laravel application, you can do so in theboot method of a service provider.
Caching
Phiki automatically enables caching when used in a Laravel application. It uses your application’s default cache store (CACHE_STORE) to cache highlighted code blocks.
If you wish to customize the cache store used by Phiki, you can do so in the boot method of a service provider.
Cache invalidation
Phiki’s cache key is based on the content of the code block, the grammar, the themes chosen, the gutter setting, and any transformers used. If any of these change, Phiki will automatically generate a new cache key and re-highlight the code block. If you need to manually clear Phiki’s cache, you can do so by calling thephp artisan cache:clear command, which will clear the entire cache for your application.
Str::markdown()
If you’re using the Str::markdown() helper method, you can use Phiki’s CommonMark extension to highlight code blocks inside of your Markdown.
Enabling the gutter
As per the documentation on Phiki’s gutter, you can enable the gutter by enabling it in thePhikiExtension constructor.
Using multiple themes
As per the documentation on Multiple themes, you can also pass in an array of themes to thePhikiExtension constructor.
Using customizations
If you have registered custom extensions, grammars, or theme using thePhiki facade as shown above, you can use them inside of your Markdown by resolving the Phiki\Phiki singleton from Laravel’s service container and passing it to the PhikiExtension constructor.
Blade component
If you want to highlight code inside of a Blade view, Phiki provides a Blade component that you can use.Grammar::Php grammar and the Theme::GithubLight theme.
Enabling the gutter
To enable the gutter, add thegutter attribute to the component.
Changing the starting line number
To change the starting line number, add thestarting-line attribute to the component.
Passing code as an attribute
Since Laravel trims whitespace from the slot of a Blade component, you can also pass the code to the component using thecode attribute.