contentful/contentful-bundle

A Symfony Bundle to integrate the Contentful CDA SDK

3.0.0 2018-06-19 13:55 UTC

README

Packagist PHP from Packagist Travis Packagist Codecov

Symfony Bundle for the Contentful SDK.

What is Contentful?

Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.

This bundle requires at least PHP 5.5.9 and Symfony 2.7. PHP 7 and Symfony 3 are supported.

Setup

To add this package to your composer.json and install it execute the following command:

composer require contentful/contentful-bundle

Add ContentfulBundle to your application

Symfony 4

// config/bundles.php
return [
    // ...
    Contentful\ContentfulBundle\ContentfulBundle::class => ['dev' => true],
    // ...
];

Symfony 3

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Contentful\ContentfulBundle\ContentfulBundle(),
        // ...
    );
}

Configuration example

The simplest configuration includes just the space ID and token. Add these settings to either app/config.yml (Symfony 3) or create config/packages/contentful.yaml (Symfony 4):

contentful:
    delivery:
        space: cfexampleapi
        token: b4c0n73n7fu1

You can also configure multiple clients and enable the preview mode:

contentful:
    delivery:
        default_client: exampleapi
        clients:
            exampleapi:
                space: cfexampleapi
                token: b4c0n73n7fu1
            exapleapi_preview:
                space: cfexampleapi
                token: b4c0n73n7fu1
                preview: true

Requisites

This bundle uses Twig. Make sure it is enabled in your configuration.

Documentation

Getting Started Tutorial

License

Copyright (c) 2015-2017 Contentful GmbH. Code released under the MIT license. See LICENSE for further details.