PHP code example of francescobruno-cmv / clickable-links

1. Go to this page and download the library: Download francescobruno-cmv/clickable-links 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/ */

    

francescobruno-cmv / clickable-links example snippets


use FrancescoBrunoCmv\ClickableLinks\Linkifier;

$text = "Visita https://example.com o scrivici a [email protected]";

echo Linkifier::process($text);
// Visita <a href="https://example.com" target="_blank">https://example.com</a>
// o scrivici a <a href="mailto:[email protected]" target="_blank">[email protected]</a>

// URL HTTPS
Linkifier::process("Visita https://example.com");
// → Visita <a href="https://example.com" target="_blank">https://example.com</a>

// WWW senza protocollo
Linkifier::process("Vai su www.example.com");
// → Vai su <a href="http://www.example.com" target="_blank">www.example.com</a>

// Email
Linkifier::process("Scrivi a [email protected]");
// → Scrivi a <a href="mailto:[email protected]" target="_blank">[email protected]</a>

// Skype
Linkifier::process("Chiamami su skype:myusername");
// → Chiamami su <a href="skype:myusername" target="_blank">skype:myusername</a>

// Contenuto misto
Linkifier::process("Sito: www.example.com | Email: [email protected] | FTP: ftp.example.com");
// → Tutti e tre convertiti in anchor tag cliccabili