This is a sample website written in PHP 7 using Laravel framework and Kontent.ai Delivery SDK for PHP. You can register your Kontent account for free at https://app.kontent.ai.
Before you can run the app, make sure your environment is set up correctly with PHP 8+ and the Composer package manager installed.
- For Windows, see how to configure Visual Studio Code for PHP development.
- For Linux distributions, see how to configure PHP Storm for PHP development.
Once these prerequisites are met, you can run the application as follows:
- Clone this repository.
- In your command line, navigate to the project folder.
- Run
composer install
to install dependencies. - (Optional) Run
composer run prepare-environment
to create a sample Laravel environment file. - Run
php artisan serve
to run the sample app.
The app is now running locally at 127.0.0.1:8000
(default) and you can open it in your browser.
Alternatively, you can also deploy your application to your Apache server by cloning the repository, running composer install
, and accessing corresponding address on your server.
This sample website displays content from a Sample Project that demonstrates Kontent.ai features and best practices. This fully featured project contains marketing content for Dancing Goat – an imaginary chain of coffee shops. By default, this sample website uses a shared project where the content remains constant for everyone.
You can change the source Kontent.ai project to your own project to be able to change the content. If you don't have your own Sample Project, any admin of a Kontent.ai subscription can generate one.
When you have a Sample Project, follow these steps to connect it to this sample app:
- In Kontent.ai, choose Project settings from the app menu.
- Under Development, choose API keys.
- Copy your Project ID.
- Set you
PROJECT_ID
environment variable - most probably in.env
file - Save the
.env
file and restart the server.
Now when you run the sample application, content is retrieved from your project.
If you want to adjust CSS and Javascript file, you need to rebuild them.
First you need to install yarn and install dependencies by running following command in repository root.
yarn
For development purposes you want to turn on development mode of compilation wit hot-reload capabilities.
yarn watch // or `yarn dev` for single development compilation
Tor production compilation, run:
yarn prod
- Navigate to https://app.kontent.ai in your browser.
- Sign in with your credentials.
- Manage content in the content administration interface of your sample project.
You can learn more about content editing with in the Kontent.ai Learn portal.
You can retrieve content either through the Kontent.ai Delivery SDKs or the Kontent.ai Delivery API:
- For published content, use
https://deliver.kontent.ai/PROJECT_ID/items
. - For unpublished content, use
https://preview-deliver.kontent.ai/PROJECT_ID/items
.
For more info about the API, see the API reference.
You can find the Delivery and other SDKs at Kontent.ai Github Organization.
Check out the contributing page to see the best places to file issues, start discussions, and begin contributing.
We would like to express our thanks to Stephen Rushing who created this sample application.