ppito / contentful-html-to-rich-text
Contentful - HTML to Rich Text
Installs: 9 282
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:module
Requires
- php: ^7.3 || ^8.0
- neitanod/forceutf8: ~2.0
This package is auto-updated.
Last update: 2025-02-15 13:12:54 UTC
README
A library to convert basic HTML to Contentful Rich Text.
Installation
Using composer:
composer require ppito/contentful-html-to-rich-text
Usage
Basic
<?php // composer require contentful/contentful-management require __DIR__ . '/vendor/autoload.php'; $content = \Contentful\HtmlToRichText\Tool::parse("<p>Hello</p><p>Another with <strong>bold maybe?</strong></p>");
Supported
The library will convert automatically the following HTML tags :
h1
h2
h3
h4
h5
h6
div
p
ul
ol
li
blockquote
br
hr
a
span
strong
b
u
em
i
code
section
footer
header
nav
aside
Unsupported
The attribute HTML are not supported (id=""
, class=""
, style=""
, etc.)