PHP code example of roelofjan-elsinga / prismic-php
1. Go to this page and download the library: Download roelofjan-elsinga/prismic-php 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/ */
roelofjan-elsinga / prismic-php 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');
bash
$ composer