Install on a new Contentful project

Netgen provides an uptodate installation of Contentful with Netgen Layouts pre-installed. The installation is based on a Symfony Website Skeleton, ready to be used as a base for your new project.

Create a database

Create a database for your project with:

CREATE DATABASE my_project CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

Use Composer

Install Composer and execute the following from a directory of your choice:

$ composer create-project netgen/layouts-contentful-site my_project
$ cd my_project

Create a .env.local file in the project root directory to specify database connection details:

DATABASE_URL=mysql://user:[email protected]/my_project

Install the database

Run the following commands from the project root to install Netgen Layouts database tables:

$ php bin/console doctrine:schema:update --force
$ php bin/console doctrine:migrations:migrate --configuration=vendor/netgen/layouts-core/migrations/doctrine.yml

Configure Contentful

Configure the app to use your Contentful instance by specifying CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN environment variables.

For development purposes, you can use a .env.local file in the root of the project:

CONTENTFUL_SPACE_ID=cfexampleapi
CONTENTFUL_ACCESS_TOKEN=b4c0n73n7fu1

Start the app

You can use the built-in Symfony web server to serve the app:

$ php bin/console server:start

After that, open http://127.0.0.1:8000 in your browser to run the app. Netgen Layouts admin interface is available at http://127.0.0.1:8000/nglayouts/admin and you can use admin as the username and password to access it.

What next?

Read up on how to achieve various developer tasks in Netgen Layouts by visiting the Cookbook docs section.