Download the PHP package jmbtechnologylimited/linkify without Composer
On this page you can find all versions of the php package jmbtechnologylimited/linkify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jmbtechnologylimited/linkify
More information about jmbtechnologylimited/linkify
Files in jmbtechnologylimited/linkify
Package linkify
Short Description Converts URLs and email addresses in text into HTML links
License MIT
Homepage https://github.com/misd-service-development/php-linkify
Informations about the package linkify
Linkify Fork
Converts URLs and email addresses into clickable links. It works on both snippets of HTML (or plain text) and complete HTML pages.
There are many regex variations shared on the internet for performing this task, but few are robust. Linkify contains a large number of unit tests to counter this.
It does not cover every possible valid-yet-never-used URLs and email addresses in order to handle 'real world' usage (eg no 'gopher://'). This means, for example, that it copes better with punctuation errors.
It was forked in March 2019 as the original maintainers have stopped responding. See https://github.com/misd-service-development/php-linkify
Authors
- Chris Wilkinson
- JMB Technology https://www.jmbtechnology.co.uk/
It uses regex based on John Gruber's Improved Liberal, Accurate Regex Pattern for Matching URLs.
Installation
composer require jmbtechnologylimited/linkify
Usage
Will output:
Options
Options set on the constructor will be applied to all links. Alternatively you can place the options on a method call. The latter will override the former.
Will output:
Whereas:
Will output:
Available options are:
attr
An associative array of HTML attributes to add to the link. For example:
callback
A closure to call with each url match. The closure will be called for each URL found with three parameters: the url, the caption and a boolean isEmail
(if $isEmail
is true, then $url
is equals to $caption
.
If the callback return a non-null value, this value replace the link in the resulting text. If null is returned, the usual <a href="URL">CAPTION</a>
is used.
Developers
There is a vagrant box. Simply ssh in and type test
to test.