- How do I install and use nadar/quill-delta-parser in a Laravel app?
- Install it with Composer using composer require nadar/quill-delta-parser. Pass the Quill Delta JSON string or PHP array into nadar\quill\Lexer and call render() to get HTML. You can call the parser from a controller, service class, or Blade view composer; the package is framework-agnostic and does not require a Laravel service provider.
- What PHP and Laravel versions does quill-delta-parser support?
- The package requires PHP 8.1 or newer and has no Laravel-specific runtime dependency. Because it is framework-agnostic, it works with modern Laravel releases that support PHP 8.1 and above. Always check the Composer constraints before pinning a version in production.
- How do I add custom elements or listeners to the parser?
- Every element is handled through the same listener mechanism, so you can create a custom listener class and extend the parser to handle your own Delta attributes or inserts. Register your listener where the Lexer or parser is configured, then test edge cases such as nested custom elements. This keeps custom rendering logic separate from the built-in listeners.
- How do I configure allowed URI schemes for links, images, and videos?
- Version 3.7.1 validates link, image, and video URI schemes against an allowlist exposed through the public $safeSchemes property. In Laravel you can map this to a config value such as quill.safe_schemes and bind it through a service provider to keep policy out of application code. Before upgrading, enumerate legacy schemes like ftp, custom app schemes, or signed asset URLs and add only the ones your deployment requires.
- Is quill-delta-parser safe for user-generated Quill content?
- The package sanitizes rendered output values and, since 3.7.1, validates URI schemes for links, images, and videos. It is still only a partial sanitizer: style, font-size, and color attribute values plus element or class injection remain the application's responsibility. Keep an HTML sanitizer on the render path, especially when rendering user-supplied Deltas.
- How does the parser handle Quill font-size attributes?
- The Size listener added in 3.7.0 supports Quill font-size formatting and renders semantic font-size attributes in the HTML, which makes CSS overrides and responsive adjustments easier. You can extend or transform font-size values, for example converting px to rem for consistency. Validate that values are numeric or use valid CSS units because Delta schema drift is still an application concern.
- Why did images, videos, or links disappear after upgrading to 3.7.1?
- Version 3.7.1 applies the URI scheme allowlist at parse and render time. Links with unsafe schemes render as #, while images and videos with unsafe schemes are suppressed entirely, and existing stored Deltas are not migrated or rewritten. Audit your content, configure $safeSchemes for any legitimate legacy schemes, and test representative Deltas before deploying the upgrade.
- Can I use quill-delta-parser outside Laravel with plain PHP?
- Yes. It is a Composer library with no Laravel dependency, so you can require vendor/autoload.php, instantiate nadar\quill\Lexer with a JSON string or PHP array, and echo the render() result. Laravel integration is optional and mainly useful for configuration binding, dependency injection, or Blade output handling.
- How should I test Deltas and custom listeners with this package?
- Use PHPUnit or your normal test suite to cover representative Deltas, nested custom elements, font-size values, and unsafe URI schemes. Assert both the rendered HTML and the sanitization behavior, including link replacement and suppressed image or video output. For very large Deltas, add performance checks and cache parsed HTML where appropriate.
- What should I know about maintenance and alternatives for quill-delta-parser?
- Pin to a supported minor version, track security advisories, and plan to consolidate on the 3.7.x line even though the URI scheme fix was backported to the 3.5.1 line. Alternatives include other Quill Delta renderers combined with a dedicated HTML sanitizer. This package is lightweight and extendable, but regardless of the renderer you choose, keep an HTML sanitizer on the output path.