Getting started using the PHP starter kit

prismic.io makes it easy to get started on a new PHP project by providing a specific PHP starter project kit. First you need to define, edit, and publish your content in a prismic.io Content Repository. Then you can use the starter kit to query and fetch content from your API. Finally, integrate the content into your website templates.

If you’re just getting started with prismic.io make to check out our PHP Quickstart Example to see how to get a repository set up and a simple PHP website running in minutes. If you’ve gone through that example already or just want to start digging into your project, this page walks you through getting up and running using the PHP starter project kit.

Create a content repository

A content repository is where you can define, edit, and publish your website content.

Create a new repository

Download the PHP starter kit

The starter kit allows you to query and retrieve content from your prismic.io content repository and integrate it into your website template. It's the easiest way to get started with a new project.

If you are not starting a brand new project, then check out our Integrating with an existing project page. Otherwise, use the link below to download the kit.

Download the kit

Unzip the downloaded project files into a the desired location for your new project.

Configure your project

Replace the repository url in your prismic.io configuration file (config.php) with your repository’s api endpoint.

Copy
// In config.php
define('PRISMIC_URL', 'https://your-repo-name.prismic.io/api');

Fire up a terminal (command prompt or similar on Windows), point it to your project location and run the following commands!

Note that you will need to make sure to first have Composer installed before running this command. Check out the Composer Getting Started page for installation instructions.

First you’ll need to install the dependencies for the project. Run the following command.

Copy
composer install

Now you can to launch your local server.

Copy
./serve.sh

You can now open your browser to http://localhost:8000/, where you will find a help page. This page contains information helpful to getting started. You will learn how to query the api and start building pages for your new site.

And your prismic.io journey begins!

Now you're all set to start building your new website with the prismic.io content management system. Here are the next steps you need to take.

Define your Custom Types

First you will need to model your pages, blog posts, articles, etc. into different Custom Types. Refer to our documentation to learn more about constructing your Custom Types using our easy drag and drop builder.

Query your documents

After you have created and published some documents in your content repository, you will be able to query your API and retrieve the content. We provide explanations and plenty of examples of queries in the documentation. Start by learning more on the How to Query the API page.

Integrate content into your templates

The final step will be to integrate your content into the website templates. Helper functions are provided for each content field type to make integration quick and easy. Check out the templating documentation for each field to learn more.