Download the PHP package yarri/keywords-highlighter without Composer

On this page you can find all versions of the php package yarri/keywords-highlighter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package keywords-highlighter

Keywords Highlighter

Build Status Downloads

Highlights keywords (typically a search query) in a HTML string.

Basic usage

$html_text = '
  <h1>The truth about pizza and beer</h1>

  <p>
    Beer and pizza.
    It might be one of the most obvious food pairings on the planet...
  </p>
';

$highlighter = new \Yarri\KeywordsHighlighter();

echo $highlighter->highlight($html_text,"pizza beer");

//  <h1>The truth about <mark>pizza</mark> and <mark>beer</mark></h1>
//
//  <p>
//    <mark>Beer</mark> and <mark>pizza</mark>.
//    It might be one of the most obvious food pairings on the planet...
//  </p>

The default tag for highlighting can be overwritten in options of the constructor.

$highlighter = new \Yarri\KeywordsHighlighter([
  "opening_tag" => '<span class="highlight">',
  "closing_tag" => '</span>',
]);

echo $highlighter->highlight($html_text,"pizza beer");

//  <h1>The truth about <span class="highlight">pizza</span> and <span class="highlight">beer</span></h1>
//
//  <p>
//    <span class="highlight">Beer</span> and <span class="highlight">pizza</span>.
//    It might be one of the most obvious food pairings on the planet...
//  </p>

KeywordsHighlighter doesn't highlight something inside a html tag.

$html_text = '
  <h1>The truth about the H1 element</h1>
';

$highlighter = new \Yarri\KeywordsHighlighter();

echo $highlighter->highlight($html_text,"h1");

// <h1>The truth about the <mark>H1</mark> element</h1>

Installation

composer require yarri/keywords-highlighter

Testing

composer update --dev
cd test
../vendor/bin/run_unit_tests

All versions of keywords-highlighter with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yarri/keywords-highlighter contains the following files

Loading the files please wait ...