PHP code example of storyblok / richtext-resolver

1. Go to this page and download the library: Download storyblok/richtext-resolver 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/ */

    

storyblok / richtext-resolver example snippets


use Storyblok\RichtextRender\Resolver;

$resolver = new Resolver();


// previous code...

// Note that in php our objects use multidimensional array notation
$data = [
  "type" => "doc",
  "content" => [
    [
      "type" => "horizontal_rule"
    ]
  ]
];

$resolver->render($data) # renders a html string: '<hr />'

$resolver = new Resolver($my_custom_schema);