{"id":27075850,"url":"https://github.com/webfoo/html-to-shopify-rich-text","last_synced_at":"2026-02-17T00:34:01.060Z","repository":{"id":286294104,"uuid":"960920952","full_name":"webfoo/html-to-shopify-rich-text","owner":"webfoo","description":"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.","archived":false,"fork":false,"pushed_at":"2025-04-05T14:31:31.000Z","size":15,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-15T04:06:43.597Z","etag":null,"topics":["parser","php","shopify"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webfoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-05T11:04:31.000Z","updated_at":"2025-12-03T08:48:30.000Z","dependencies_parsed_at":"2025-04-05T15:24:16.671Z","dependency_job_id":null,"html_url":"https://github.com/webfoo/html-to-shopify-rich-text","commit_stats":null,"previous_names":["webfoo/html-to-shopify-rich-text","kevinruscoe/htmltoshopifyrichtext"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/webfoo/html-to-shopify-rich-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfoo%2Fhtml-to-shopify-rich-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfoo%2Fhtml-to-shopify-rich-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfoo%2Fhtml-to-shopify-rich-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfoo%2Fhtml-to-shopify-rich-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webfoo","download_url":"https://codeload.github.com/webfoo/html-to-shopify-rich-text/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfoo%2Fhtml-to-shopify-rich-text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29526885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T21:45:09.491Z","status":"ssl_error","status_checked_at":"2026-02-16T21:44:58.452Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","php","shopify"],"created_at":"2025-04-06T00:18:10.995Z","updated_at":"2026-02-17T00:34:01.033Z","avatar_url":"https://github.com/webfoo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HtmlToShopifyRichText\n\nA 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.\n\n## Features\n\n- Converts common HTML elements to Shopify Rich Text format\n- Supports headings (h1-h6)\n- Handles paragraphs, lists (ordered and unordered)\n- Processes inline elements (bold, italic, links)\n- Sanitizes HTML input\n- Validates HTML structure\n- Handles whitespace normalization\n- Provides detailed error handling\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require webfoo/html-to-shopify-rich-text\n```\n\n## Usage\n\n```php\nuse Webfoo\\HtmlToShopifyRichText\\HtmlToShopifyRichText;\n\n$html = '\u003ch1\u003eHello World\u003c/h1\u003e\u003cp\u003eThis is a \u003cstrong\u003etest\u003c/strong\u003e paragraph.\u003c/p\u003e';\n$richText = HtmlToShopifyRichText::convert($html);\n\n// $richText will contain the JSON representation of the Shopify Rich Text\n```\n\n### Supported HTML Elements\n\n- Headings: `\u003ch1\u003e` through `\u003ch6\u003e`\n- Paragraphs: `\u003cp\u003e`\n- Lists: `\u003cul\u003e`, `\u003col\u003e`, `\u003cli\u003e`\n- Links: `\u003ca href=\"...\"\u003e`\n- Bold: `\u003cstrong\u003e`, `\u003cb\u003e`\n- Italic: `\u003cem\u003e`, `\u003ci\u003e`\n\n## Error Handling\n\nThe package throws specific exceptions for different error scenarios:\n\n- `InvalidHtmlException`: Thrown when the HTML is invalid or cannot be parsed\n- `ConversionException`: Thrown when the conversion process fails\n- `JsonEncodingException`: Thrown when the JSON encoding fails\n\nExample error handling:\n\n```php\ntry {\n    $richText = HtmlToShopifyRichText::convert($html);\n} catch (InvalidHtmlException $e) {\n    // Handle invalid HTML\n} catch (ConversionException $e) {\n    // Handle conversion errors\n} catch (JsonEncodingException $e) {\n    // Handle JSON encoding errors\n}\n```\n\n## Requirements\n\n- PHP 8.1 or higher\n- Composer\n- Required dependencies:\n  - `symfony/dom-crawler`\n  - `ezyang/htmlpurifier`\n\n## License\n\nThis package is open-sourced software licensed under the MIT license.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfoo%2Fhtml-to-shopify-rich-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfoo%2Fhtml-to-shopify-rich-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfoo%2Fhtml-to-shopify-rich-text/lists"}