misd-service-development / php-linkify

Converts URLs and email addresses into HTML links
MIT License
112 stars 17 forks source link

Add an option to only linkify URLs that start with a scheme #19

Open hubgit opened 7 years ago

hubgit commented 7 years ago

Adding a require_scheme option allows a user to disable auto-linking of things that look like URLs (e.g. www.example.com), so that only full URLs (e.g. https://www.example.com) are auto-linked. The scheme currently has to match ~^(ht|f)tps?://~.

Example usage:

$html = $linkify->processUrls($html, [
  'require_scheme' => true
]);