Getting Started: Vanilla PHP
Install from composer.
composer require incraigulous/prismic-toolkit
To get started, simply pass any official Prismic API Kit response into the fluent response factory:
//This can be done upon the initial API Kit handshake
$wrappedClient = \Incraigulous\PrismicToolkit\FluentResponse::make(
\Prismic\Api::get(
YOUR_ENDPOINT,
YOUR_TOKEN
)
);
$imageUrl = $wrappedClient
->getByUID('single', 'test-single')
->heroImage
->main
->getUrl();
//Or any other response retrieved by the API
$client = \Prismic\Api::get(
YOUR_ENDPOINT,
YOUR_TOKEN
)
$response = $client->getByUID('single', 'test-single');
$wrappedResponse = \Incraigulous\PrismicToolkit\FluentResponse::make(response);
$imageUrl = $wrappedResponse
->getByUID('single', 'test-single')
->hero_image
->main
->getUrl();