PHPackages                             netglue/prismic-doctype-client - 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. netglue/prismic-doctype-client

ActiveLibrary[API Development](/categories/api)

netglue/prismic-doctype-client
==============================

Prismic Custom Type API Client

1.8.0(3mo ago)198.9k↑104.3%[1 PRs](https://github.com/netglue/prismic-doctype-client/pulls)1MITPHPPHP ~8.2.0 || ~8.3 || ~8.4 || ~8.5CI passing

Since Sep 1Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/netglue/prismic-doctype-client)[ Packagist](https://packagist.org/packages/netglue/prismic-doctype-client)[ Docs](https://github.com/netglue/prismic-doctype-client)[ RSS](/packages/netglue-prismic-doctype-client/feed)WikiDiscussions 1.9.x Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (30)Used By (1)

Prismic Document Type API Client
================================

[](#prismic-document-type-api-client)

[![Build Status](https://github.com/netglue/prismic-doctype-client/workflows/Continuous%20Integration/badge.svg)](https://github.com/netglue/prismic-doctype-client/actions?query=workflow%3A%22Continuous+Integration%22)

[![codecov](https://camo.githubusercontent.com/41b17c46c21c8f07e9082d1be1a7d4a9a63c4c2eb951db0dc7e8ac51dae0df16/68747470733a2f2f636f6465636f762e696f2f67682f6e6574676c75652f707269736d69632d646f63747970652d636c69656e742f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/netglue/prismic-doctype-client)[![Psalm Type Coverage](https://camo.githubusercontent.com/d648e89feefe7a7174e3bf1107c8d32bfbd75955e1d5a3a92f8c999720634e3a/68747470733a2f2f73686570686572642e6465762f6769746875622f6e6574676c75652f707269736d69632d646f63747970652d636c69656e742f636f7665726167652e737667)](https://shepherd.dev/github/netglue/prismic-doctype-client)

[![Latest Stable Version](https://camo.githubusercontent.com/a9433807637904d716a602760682a8b18348af58f40e0440aa052085fa43f3e4/68747470733a2f2f706f7365722e707567782e6f72672f6e6574676c75652f707269736d69632d646f63747970652d636c69656e742f762f737461626c65)](https://packagist.org/packages/netglue/prismic-doctype-client)[![Total Downloads](https://camo.githubusercontent.com/046a5da6708932422203aeebca7b2fc45543212d2aad6f0be786e83e2c816490/68747470733a2f2f706f7365722e707567782e6f72672f6e6574676c75652f707269736d69632d646f63747970652d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/netglue/prismic-doctype-client)

Introduction
------------

[](#introduction)

This library provides an API client so that you can read and write your document type definitions using the [Prismic Custom Types API](https://prismic.io/docs/technologies/custom-types-api).

Currently, you can list, read, insert and update document types, and do the same for 'Shared Slices'

The client requires that you make use of *(And similarly, it returns instances of)* the shipped `Definition` or `SharedSlice` value objects.

Typically, you wouldn't interact with the client directly, but as part of a build process that takes care of all that stuff for you. This client is quite fresh, but it's primary use will soon be part of [`netglue/prismic-cli`](https://github.com/netglue/prismic-cli), so that it will become trivial to synchronise your local development document definitions with those in your production Prismic repository *(and vice-versa)*.

It's worth noting that document types and slices are not validated in any way. That's up to you, but, you should get descriptive exceptions when your JSON doesn't validate on the remote server.

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

[](#installation)

The only supported installation method is via composer:

```
composer require --dev netglue/prismic-doctype-client
```

Configuration
-------------

[](#configuration)

The client has been designed to work with whatever [PSR-18 HTTP Client](https://packagist.org/providers/psr/http-client-implementation) and [PSR-7 and PSR-17 implementations](https://packagist.org/providers/psr/http-factory-implementation) that you like to use. Once you have got hold of an API token for the custom types API, you can create a client with:

```
