PHPackages                             glhd/laravel-prismoquent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. glhd/laravel-prismoquent

ActiveLibrary[API Development](/categories/api)

glhd/laravel-prismoquent
========================

Prismoquent lets you access Prismic.io using the same methods you're used to in Eloquent.

0.5.1(7y ago)22.3k1MITPHPPHP &gt;=7.1

Since Aug 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/glhd/laravel-prismoquent)[ Packagist](https://packagist.org/packages/glhd/laravel-prismoquent)[ RSS](/packages/glhd-laravel-prismoquent/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (9)Versions (20)Used By (0)

An eloquent way to access Prismic.io content
============================================

[](#an-eloquent-way-to-access-prismicio-content)

 [ ![CircleCI Build Status](https://camo.githubusercontent.com/c1ef785cb937b5757752d36ceb6a02169f7289289bfc6fb30e36c1215e9080ec/68747470733a2f2f636972636c6563692e636f6d2f67682f676c68642f6c61726176656c2d707269736d6f7175656e742e7376673f7374796c653d737667) ](https://circleci.com/gh/glhd/laravel-prismoquent) [ ![Code Coverage Status](https://camo.githubusercontent.com/2fa9a3d20548d8c63d96e3a70c52bd88641eb8a8baec998539859e9276db53c2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f676c68642f6c61726176656c2d707269736d6f7175656e742f62616467652e7376673f6272616e63683d6d6173746572) ](https://coveralls.io/github/glhd/laravel-prismoquent?branch=master) [ ![Stable version on Packagist](https://camo.githubusercontent.com/daf8f9837b08df768a80cf9e49f04c53b08bbc5b20b1cddf1dcc1e3a28203452/68747470733a2f2f706f7365722e707567782e6f72672f676c68642f6c61726176656c2d707269736d6f7175656e742f762f737461626c65) ![Dev version on Packagist](https://camo.githubusercontent.com/411d739955bd7967b8c58d0c8c8bdf5bd589b8c8b64d1d982ff1f18b499e8d61/68747470733a2f2f706f7365722e707567782e6f72672f676c68642f6c61726176656c2d707269736d6f7175656e742f762f756e737461626c65) ](https://packagist.org/packages/glhd/laravel-prismoquent) [ ![Code Style Status](https://camo.githubusercontent.com/bf3839a507413fbb01c58123e3fff18e49aeb2a26456ab961959d1087fb35168/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134333337353331302f736869656c643f6272616e63683d6d6173746572) ](https://github.styleci.io/repos/143375310) [ ![License](https://camo.githubusercontent.com/c43a0fa488f42c52c1c4bc0d9958e4d753516f2e3a5c0bc127f8316005d6cc3d/68747470733a2f2f706f7365722e707567782e6f72672f676c68642f6c61726176656c2d707269736d6f7175656e742f6c6963656e7365) ](license.txt)

This package provides a mostly Eloquent-compatible Model that you can use to access content from [Prismic.io](https://prismic.io) as though it were a standard Eloquent model.

#### App/Page.php

[](#apppagephp)

```
class Page extends \Galahad\Prismoquent\Model
{
	// Automatically inferred from class name ("page") if left unset
	protected $type;

	// Cast RichText to text or HTML (all other cast types also supported)
	protected $casts = [
		'title' => 'text',
		'body' => 'html',
	];

	// Resolve links as though they were relationships
	public function authorLinkResolver() : ?Person
	{
		return $this->hasOne('author', Person::class);
	}

	// Also supports repeating groups of links
	public function similarPagesLinkResolver()
	{
		return $this->hasMany('similar_pages.page', static::class);
	}
}
```

#### App/Http/Controllers/PageController.php

[](#apphttpcontrollerspagecontrollerphp)

```
class PageController extend Controller
{
	public function show(Page $page)
	{
		return view('page.show', compact('page'));
	}
}
```

#### resources/views/page/show.blade.php

[](#resourcesviewspageshowbladephp)

```
{{ $page->title }}

	{{ $page->body }}

```

```
// Familiar API
$page = Page::where('document.id', 'W2N5Dx8AAD1TPaYt')->first();
$page = Page::find('W2N5Dx8AAD1TPaYt');
$page = Page::findOrFail('W2N5Dx8AAD1TPaYt');

echo "{$page->title}";
echo $page->body;

echo "Written by {$page->author->name}"
echo "Similar Pages";

foreach ($page->similar_pages as $similar_page) {
	echo "{$similar_page->title}";
	echo "{$similar_page->meta_description}";
}

// With full support for all Prismic predicates
Page::where('my.page.body', 'fulltext', 'laravel')->get();
```

Warning: Active Development
---------------------------

[](#warning-active-development)

This project is still in active development and may have many bugs. Use at your own risk!

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require glhd/laravel-prismoquent
```

Usage
-----

[](#usage)

See above for a basic example. More details coming soon.

### Configuration

[](#configuration)

Looks for config in your `services.php` file:

```
return [
	'prismic' => [
		'endpoint' => env('PRISMIC_ENDPOINT'), // Required
		'api_token' => env('PRISMIC_API_TOKEN'), // Optional, depending on your Prismic permissions
		'webhook_secret' => env('PRISMIC_WEBHOOK_SECRET'), // Optional, if you're using build-in controller
		'register_controller' => false, // Set to false to disable Webhook controller
    ]
];
```

### Link Resolution

[](#link-resolution)

You can register link resolvers as either a callable or a route name:

```
// In your AppServiceProvider
Prismic::registerResolver('page', 'pages.show');
Prismic::registerResolver('person', function(DocumentLink $link) {
	return url('/people/'.$link->getUid());
});

// In your web.php route file
Route::get('/pages/{page}', 'PageController@show')->name('pages.show');
```

If you do not set up a resolver, Prismoquent will try a resource route for your document. So `Page` will try `route('pages.show', $uid)` or `NewsItem` will try `route('news_items.show', $uid)`.

Once your resolvers are defined, you can resolve links in any Prismic Fragment using:

```
$html = Prismic::asHtml($fragment);
```

### Blade Directives

[](#blade-directives)

```
{{-- Will render slice object using views/slices/slice-type.blade.php --}}
@slice($object_implementing_slice_tnterface)

{{-- Will render all slices in slice zone using @slice directive --}}
@slice($slice_zone_object)

{{-- Converts frament to HTML using link resolver --}}
@asHtml($fragment)

{{-- Converts frament to plain text --}}
@asText($fragment)

{{-- Converts a DocumentLink fragment to the resolved URL --}}
@resolveLink($documentLink)
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](license.txt) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Recently: every ~27 days

Total

19

Last Release

2560d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21592?v=4)[Chris Morrell](/maintainers/inxilpro)[@inxilpro](https://github.com/inxilpro)

---

Top Contributors

[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (58 commits)")[![bogdankharchenko](https://avatars.githubusercontent.com/u/32746389?v=4)](https://github.com/bogdankharchenko "bogdankharchenko (1 commits)")

---

Tags

laravelPrismicprismicio

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/glhd-laravel-prismoquent/health.svg)

```
[![Health](https://phpackages.com/badges/glhd-laravel-prismoquent/health.svg)](https://phpackages.com/packages/glhd-laravel-prismoquent)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
