| name | contentstack-utils |
|---|---|
| description | Use when changing Utils, GQL, BaseParser, models, enums, or embed/render behavior — the library’s public surface and integration boundaries. |
- Adding or changing HTML/RTE rendering or GraphQL JSON → HTML conversion
- Extending or implementing render callbacks (
Option,RenderableInterface) - Working with metadata, embedded items, or enum-backed node/mark types
- Composer package:
contentstack/utils(Packagist); PSR-4 root namespaceContentstack\Utils\maps tosrc/.
Contentstack\Utils\Utils(src/Utils.php) — static helpers such asrenderContent/jsonToHtmlfor RTE strings and JSON payloads; extendsBaseParser.Contentstack\Utils\GQL(src/GQL.php) —jsonToHtmland related parsing for GraphQL-shaped content; extendsBaseParser.Contentstack\Utils\BaseParser(src/BaseParser.php) — shared parsing and embedded-object resolution logic.
Contentstack\Utils\Model\Option— configure rendering; subclasses overriderenderMark,renderNode,renderOptions, etc.Contentstack\Utils\Resource\RenderableInterface— contract for types that participate in rendering.Contentstack\Utils\Model\Metadata— embed metadata (e.g. style type, attributes).- Enums under
Contentstack\Utils\Enum\(NodeType,MarkType,StyleType,EmbedItemType) usemarc-mabe/php-enum.
- This package does not ship HTTP calls; consumers fetch data with the Contentstack PHP SDK or other clients and pass strings/objects into
Utils/GQL. - Prefer backward-compatible changes to public method signatures; follow SemVer.