PHP code example of zumba / prismic-sdk

1. Go to this page and download the library: Download zumba/prismic-sdk 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/ */

    

zumba / prismic-sdk example snippets



Prismic\Api;


$api = Api::get('https://your-repo-name.prismic.io/api/v2');
$doc = $api->getByUID('get-started');


use Prismic\Dom\Link;

echo Link::asUrl($doc->data->link, $linkResolver);


use Prismic\Dom\RichText;

echo RichText::asText($doc->data->title);
echo RichText::asHtml($doc->data->description, $linkResolver);


use Prismic\Dom\Date;

$date = Date::asDate($doc->data->date);
echo $date->format('Y-m-d H:i:s');