1. Go to this page and download the library: Download hirasso/autolinker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hirasso / autolinker example snippets
use Hirasso\Autolinker\Autolinker;
echo Autolinker::link('Visit https://example.com or mail [email protected]');
// Visit <a href="https://example.com">example.com</a>
// or mail <a href="mailto:[email protected]">[email protected]</a>
echo Autolinker::link('See https://example.com.');
// See <a href="https://example.com">example.com</a>.
use Dom\HTMLElement;
use Hirasso\Autolinker\Autolinker;
use Hirasso\Autolinker\AutolinkerOptions;
echo Autolinker::link($html, new AutolinkerOptions(
urls: true, // link urls (default: true)
emails: true, // link emails (default: true)
stripScheme: true, // strip the scheme from link texts (default: true)
truncateText: 50, // truncate link texts, ellipsis
use Dom\HTMLDocument;
use Hirasso\Autolinker\Autolinker;
$doc = HTMLDocument::createFromString($html, LIBXML_NOERROR);
Autolinker::link($doc); // $doc is now mutated in place
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.