PHP code example of netglue / expressive-prismic
1. Go to this page and download the library: Download netglue/expressive-prismic 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/ */
netglue / expressive-prismic example snippets
return [
'prismic' => [
'api' => [
'token' => 'Permanent Access Token',
'url' => 'https://Repo-name.prismic.io/api',
],
],
];
'prismic' => [
'route_params' => [
'id' => 'prismic-id',
'bookmark' => 'prismic-bookmark',
'uid' => 'prismic-uid',
'type' => 'prismic-type',
'lang' => 'prismic-lang',
],
],
/**
* @var \Zend\Expressive\Application $app
* @var \Zend\Stratigility\MiddlewarePipeInterface $middlewarePipe
*/
$app->route('/', [$middlewarePipe], ['GET'], 'home')
->setOptions([
'defaults' => [
'template' => 'page::default',
'prismic-bookmark' => 'home',
],
]);
$app->route('/case-studies/{prismic-uid}', [$middlewarePipe], ['GET'], 'case-studies')
->setOptions([
'defaults' => [
'template' => 'my:case-study',
'prismic-type' => 'case-study',
],
]);
return [
'prismic' => [
'webhook_secret' => 'SomeSuperToughSharedSecret',
],
];
return [
'prismic' => [
'webhook_url' => '/send-prismic-webhooks-here',
],
];
return [
'prismic' => [
'preview_url' => '/some-other-endpoint',
],
];
return [
'prismic' => [
'error_handler' => [
'template_404' => 'some::template-name',
'bookmark_404' => 'some-bookmark',
],
],
];
return [
'prismic' => [
'error_handler' => [
'template_error' => 'some::template-name',
'bookmark_error' => 'some-bookmark',
],
],
];