Kontent.ai comes with a few sample projects to showcase best practices. The PHP sample app is built around one of them.Here’s how you can create your own sample project:
In Kontent.ai, click your initials in the bottom left corner.
Select Projects.
At the end of the list, click Create complete sample project.
Select a subscription for the project.
Click Create project.
You now have a project named Sample Project you can use with the sample app!
In your command line, navigate to the sample app folder.
Run composer install to install the app dependencies.
Run composer run prepare-environment to create a sample Laravel environment file.
Without the environment file present, PHP will throw a warning. However, this doesn’t prevent you from starting the app.
Run php artisan serve to start the app.
Open 127.0.0.1:8000 in your browser to see the running sample app.
Connect your Kontent.ai project
By default, the sample app uses a shared Kontent.ai sample project.We recommend connecting the app to your own Sample Project so you can freely make changes and play with it.
In Kontent.ai > Environment settings > General > Environment ID, copy the Environment ID for Production.
In your .env file, set the PROJECT_ID environment variable to the value of your Environment ID.
Save the .env file and restart the server.
Now, let's explore the Sample Project and update its content so that you can see the changes reflected in your locally running application.
What's next?
Explore your sample project
Let's explore your Kontent.ai sample project and update its content so that you can see the changes reflected in your locally running sample app.