https://github.com/webfoo/html-to-shopify-rich-text
A PHP package that converts HTML content to Shopify's Rich Text format. This package provides a simple and reliable way to transform HTML content into the JSON structure that Shopify's Rich Text editor expects.
https://github.com/webfoo/html-to-shopify-rich-text
parser php shopify
Last synced: 4 months ago
JSON representation
A PHP package that converts HTML content to Shopify's Rich Text format. This package provides a simple and reliable way to transform HTML content into the JSON structure that Shopify's Rich Text editor expects.
- Host: GitHub
- URL: https://github.com/webfoo/html-to-shopify-rich-text
- Owner: webfoo
- License: mit
- Created: 2025-04-05T11:04:31.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-05T14:31:31.000Z (about 1 year ago)
- Last Synced: 2025-12-15T04:06:43.597Z (6 months ago)
- Topics: parser, php, shopify
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HtmlToShopifyRichText
A PHP package that converts HTML content to Shopify's Rich Text format. This package provides a simple and reliable way to transform HTML content into the JSON structure that Shopify's Rich Text editor expects.
## Features
- Converts common HTML elements to Shopify Rich Text format
- Supports headings (h1-h6)
- Handles paragraphs, lists (ordered and unordered)
- Processes inline elements (bold, italic, links)
- Sanitizes HTML input
- Validates HTML structure
- Handles whitespace normalization
- Provides detailed error handling
## Installation
You can install the package via Composer:
```bash
composer require webfoo/html-to-shopify-rich-text
```
## Usage
```php
use Webfoo\HtmlToShopifyRichText\HtmlToShopifyRichText;
$html = '
Hello World
This is a test paragraph.
';
$richText = HtmlToShopifyRichText::convert($html);
// $richText will contain the JSON representation of the Shopify Rich Text
```
### Supported HTML Elements
- Headings: `
` through ``
- Paragraphs: `
`
- Lists: `