markup/contentful-sdk-bridge

A small bridge library to convert resources from the official Contentful SDK into resources compatible with the markup/contentful library.

0.2.0 2019-06-25 11:30 UTC

This package is auto-updated.

Last update: 2024-04-25 22:00:26 UTC


README

A small bridge library to convert resources from the official Contentful SDK into resources compatible with the markup/contentful library.

Build Status

Installation

The Markup contentful-sdk-bridge bundle can be installed via Composer by requiring themarkup/contentful-sdk-bridge package in your project's composer.json:

{
    "require": {
        "markup/contentful-sdk-bridge": "0.1"
    }
}

Usage

The package provides some simple adapters enabling resources emitted from the official Contentful SDK to be used as if they are resources emitted from Markup's Contentful library.

Examples:

use Markup\ContentfulSdkBridge\AdaptedAsset;
use Markup\ContentfulSdkBridge\AdaptedContentType;
use Markup\ContentfulSdkBridge\AdaptedEntry;

$space = 'content_space';
$locale = 'en-US';

/** @var \Contentful\Delivery\Resource\Entry $sdkEntry */

$markupEntry = new AdaptedEntry(
    $sdkEntry,
    $locale,
    $space
);

/** @var \Contentful\Delivery\Resource\Asset $sdkAsset */

$markupAsset = new AdaptedAsset(
    $sdkAsset,
    $locale
);

/** @var \Contentful\Delivery\Resource\ContentType $sdkContentType */

$markupContentType = new AdaptedContentType($sdkContentType);