The package provide Linkify
class that matches things like email addresses, web URLs, etc. in the text and makes them clickable links.
- PHP 7.4 or higher.
The package could be installed with composer:
composer require vjik/linkify --prefer-dist
$linkify = new \Vjik\Linkify\Linkify(
new \Vjik\Linkify\HttpPattern(),
new \Vjik\Linkify\EmailPattern(),
);
$text = 'Contacts: https://example.com, info@example.com.';
$result = $linkify->process($text);
$result
will be:
Contacts: <a href="https://example.com">example.com</a>, <a href="mailto:info@example.com">info@example.com</a>.
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
The package tests are checked with Infection mutation framework with Infection Static Analysis Plugin. To run it:
./vendor/bin/roave-infection-static-analysis-plugin
The code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalm
The Linkify is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.