PHP code example of chuoke / keyword-linkify

1. Go to this page and download the library: Download chuoke/keyword-linkify 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/ */

    

chuoke / keyword-linkify example snippets


$text = '<img class="hero-logo" src="/images/logos/php-logo-white.svg" alt="php" width="240" height="120">
    <p class="hero-text">A <strong>popular general-purpose scripting language</strong> that is especially suited to web development.<br>Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.</p>';

$keywords = [
    [
        'keyword' => 'php',
        'url' => 'https://www.php.net/',
    ],
];

$keywordLinkify = new Chuoke\KeywordLinkify();
echo $keywordLinkify->replace($text, $keywords);

html
<img class="hero-logo" src="/images/logos/php-logo-white.svg" alt="php" width="240" height="120"><p class="hero-text">A <strong>popular general-purpose scripting language</strong> that is especially suited to web development.<br>Fast, flexible and pragmatic, <a target="blank" href="https://www.php.net/" title="PHP">PHP</a> powers everything from your blog to the most popular websites in the world.</p>