A PHP library for parsing, validating, and highlighting URLs in text strings, including HTML and Markdown conversion.
Url Highlight is a PHP library designed to parse URLs from string input. It detects URLs in text, including those without schemes, and can convert them to clickable HTML links or Markdown format. It handles complex URLs, edge cases, and encoded input like HTML entities, making it robust for content processing and web development tasks.
PHP developers working on content processing, text analysis, or web applications that require URL detection and formatting, such as those building CMS features, comment systems, or documentation tools. It's also suitable for developers using Twig or Symfony frameworks, given the available extensions.
Developers choose Url Highlight for its accuracy in handling edge cases and encoded input, along with its extensible design through customizable validators, highlighters, and encoders. It offers flexibility for tailored URL parsing without sacrificing performance, distinguishing it from simpler regex-based solutions.
PHP library to parse URLs from string input
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Accurately identifies URLs without schemes using top-level domain matching and handles complex edge cases, as shown in the validator configuration.
Includes built-in HtmlHighlighter and MarkdownHighlighter for converting URLs to clickable HTML or Markdown links, useful for web content or documentation.
Provides encoders like HtmlSpecialcharsEncoder to correctly parse URLs in HTML-escaped strings, preventing false matches in encoded text.
Custom validators, highlighters, and encoders can be implemented via interfaces, allowing tailored behavior for specific use cases without modifying core code.
Using encoders requires more regex operations, which the README explicitly warns can impact performance, making it less suitable for high-throughput applications.
Only one default validator is bundled, so advanced validation like blacklisting specific TLDs requires custom implementation, adding development effort.
Full integration with Twig or Symfony needs separate extensions, adding dependencies and setup steps beyond the core library.