mikkokut/prismic-laravel

Integrates the Prismic PHP development kit with Laravel.

v1.0.0 2017-05-20 15:31 UTC

This package is not auto-updated.

Last update: 2020-09-19 05:51:57 UTC


README

Build Status

Laravel integration for the Prismic PHP development kit.

Prismic provides one CMS Backend for all your Websites & Apps.

Setup

To add this package to your composer.json and install it execute the following command:

php composer require mikkokut/prismic-laravel

Add the service provider to the providers array in config/app.php:

'providers' => [
    MikkoKut\PrismicLaravel\PrismicServiceProvider::class,
],

Add the facade to the aliases array in config/app.php:

'aliases' => [
    'Prismic' => MikkoKut\PrismicLaravel\Facades\Prismic::class,
],

Configuration

Publish the config file:

php artisan vendor:publish"

This will add prismic.php to your /config folder. Next, open that file and set the credentials.

Usage

The package just initializes the Api class of the Prismic's php-kit package. You can use all public methods from the Api using the Prismic facade.

Eq. Get single

$type = 'frontpage';
$options = [];
$key = 'frontpage.title';

$document = \Prismic::getSingle($type, $options);
echo $document->getText($key);

Available methods

Refer php-kit

License

Copyright (c) 2017 Mikko Kutilainen. Code released under the MIT license.