Under the hood, Saaze uses what's known as a "container" to manage all of the class dependencies of the application. This is a common practice in modern PHP development and allows us to do some nifty things. Most importantly, it allows us to bind interfaces to implementations which makes it very easy to extend Saaze to add your own implementations if you need to.
To swap out one of the default implementations, create a
definitions.php file in the root of your Saaze project that returns an array. This file will be auto-loaded by Saaze if it exists. Add your custom implementation class to the array, using the relevant interface as the key.
Custom Tags Example
As an example, let's say you want to add a custom content parser that converts
[alert][/alert] tags in your markdown to HTML
<div class="alert"></div> tags. First, create a new PHP class at
src/CustomContentParser.php that extends the default
MarkdownContentParser class implements the
Next, create the
definitions.php file in the root of your Saaze project. Then
require your custom class and return it in the array:
Finally, update the
toHtml() method of your
CustomContentParser class to process the content: