Download the PHP package contentstack/utils without Composer
On this page you can find all versions of the php package contentstack/utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contentstack/utils
More information about contentstack/utils
Files in contentstack/utils
Package utils
Short Description Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.
License MIT
Homepage https://github.com/contentstack/contentstack-utils-php
Informations about the package utils
Contentstack PHP Utils SDK:
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. Read More.
This guide will help you get started with Contentstack PHP Utils SDK to build apps powered by Contentstack.
Prerequisites
- PHP version 5.5.0 or later
SDK Installation and Setup
To set up the Utils SDK in your PHP project, install it via gem:
If you are using Contentstack PHP SDK, then “contentstack/utils” is already imported into your project.
Usage
Let’s learn how you can use Utils SDK to render embedded items.
Create Render Option:
To render embedded items on the front-end, use the renderOptions function, and define the UI elements you want to show in the front-end of your website, as shown in the example code below:
Basic Queries
Contentstack Utils SDK lets you interact with the Content Delivery APIs and retrieve embedded items from the RTE field of an entry.
Fetch Embedded Item(s) from a Single Entry:
Render HTML RTE Embedded object
To get an embedded item of a single entry, you need to provide the stack API key, environment name, delivery token, content type’s UID, and entry’s UID. Then, use the Contentstack::renderContent
function as shown below:
If you want to render embedded items using the CustomOption function, you can refer to the code below:
Render Supercharged RTE contents
To get a single entry, you need to provide the stack API key, environment name, delivery token, content type and entry UID. Then, use Contentstack::jsonToHtml
function as shown below:
If you want to render embedded items using the CustomOption function, you can refer to the code below:
Fetch Embedded Item(s) from Multiple Entries
Render HTML RTE Embedded object
To get embedded items from multiple entries, you need to provide the stack API key, environment name, delivery token, and content type’s UID.
Render Supercharged RTE contents
To get a single entry, you need to provide the stack API key, environment name, delivery token, content type UID. Then, use Contentstack::jsonToHtml
function as shown below:
GQL
To Convert JSON RTE content to HTML from GQL API. Use GQL::jsonToHtml
function as shown below: