If you have a set of custom grammars and themes that you want to reuse across multiple projects or share with others, you can bundle them into a custom extension. Custom extensions are simple PHP classes that implement the Phiki\Contracts\ExtensionInterface interface.
use Phiki\Contracts\ExtensionInterface;
use Phiki\Environment;

class MyExtension implements ExtensionInterface
{
    public function register(Environment $environment): void
    {
        $environment
            ->grammar('my-language', __DIR__ . '/grammars/my-language.json')
            ->theme('my-theme', __DIR__ . '/themes/my-theme.json');
    }
}
You can register the custom extension using the extend() method.
use App\Phiki\MyExtension;

$phiki = (new Phiki)
    ->extend(new MyExtension);
The register() method will be called when the extension is registered and is applied to all future usage of the Phiki instance.