PHP code example of prismic / php-sdk

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

    

prismic / php-sdk example snippets



Prismic\Api;

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


use Prismic\Dom\Link;

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


use Prismic\Dom\RichText;

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


use Prismic\Dom\Date;

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