PHPackages                             netglue/prismic-php-kit - 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-php-kit

Abandoned → [netglue/prismic-client](/?search=netglue%2Fprismic-client)Library[API Development](/categories/api)

netglue/prismic-php-kit
=======================

Unofficial PHP development kit for prismic.io

5.1.2(5y ago)02.9k1Apache-2.0PHPPHP &gt;=7.1CI failing

Since Oct 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/netglue/prismic-php-kit)[ Packagist](https://packagist.org/packages/netglue/prismic-php-kit)[ RSS](/packages/netglue-prismic-php-kit/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (9)Dependencies (4)Versions (94)Used By (1)

Unofficial PHP development kit for prismic.io
=============================================

[](#unofficial-php-development-kit-for-prismicio)

Abandoned
---------

[](#abandoned)

This library is effectively abandoned in favour of a new client I've put together at [netglue/prismic-client](https://github.com/netglue/prismic-client).

It still has similarities but is mostly a re-write that takes advantage of the http related PSRs and seeks to simplify things and further improve type safety.

If you're starting a new project, want to use a client that will stick around for a while and don't want to use the outdated official client, then choose that…

If you are already using this, like I am on some older projects, then feel free to contribute patches if need be.

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

[](#introduction)

This fork of the [official Prismic.io library](https://github.com/prismicio/php-kit) differs in a few ways and is more similar to the 3.x version of the original kit than the 4.x version that's currently in beta.

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

[](#installation)

[Composer](https://getcomposer.org) is the only 'supported' installation method:

```
$ composer require netglue/prismic-php-kit
```

Usage
-----

[](#usage)

You'll need a content repository all setup and ready to go at [Prismic.io](https://prismic.io), if you don’t know anything about prismic.io yet, take a [look at the website](https://prismic.io) and the [documentation about content modelling](https://user-guides.prismic.io/content-modeling-and-custom-types) and [sign up for an account](https://prismic.io/signup).

Prismic content repositories expose a url to direct your API queries to in the form of `https://.prismic.io/api`. Your repository may or may not require an access token depending on how you have set it up. There are currently 2 versions of the content API which are accessible at different URLs. V1 of the API is available at `/api` or `/api/v1` whereas V2 of the API is available at `/api/v2`. This kit attempts to support both versions of the API transparently. The V1 api appears to be the same as V2 with the exception that the responses in V1 are more verbose. There's no date for deprecation of the v1 api and I’m not aware of any functional differences between the two versions.

Once you have the details for your repository, you can create an API client in the following way *(Assuming you have setup [composer autoloading](https://getcomposer.org/doc/01-basic-usage.md#autoloading))*:

```
use Prismic\Api;
$accessToken = 'AccessTokenString Or null';
$api = Api::get('https://.prismic.io/api/v1', $accessToken);
```

Results from the API
--------------------

[](#results-from-the-api)

In most cases, you'll probably be retrieving either a single document or a result set from the API, for example, using the api client to retrieve a single document by it's identifier goes something like this: `$api->getById('SomeIdentifier');`, whereas a query to get all the documents of a specific type may look like…

```
