Download the PHP package yarri/link-finder without Composer
On this page you can find all versions of the php package yarri/link-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package link-finder
LinkFinder
In a plain text document the LinkFinder searches for URLs and email addresses and makes them clickable, in a HTML document searches for missing links and makes them clickable too.
Usage
Extra attributes for and elements can be specified in options:
Escaping of HTML entities is enabled by default:
Creating missing links on URLs or emails in a HTML document:
Method $lf->processHtml()
is actually an alias for $lf->process($html_document,["escape_html_entities" => false])
.
In case of processing a HTML text, the LinkFinder doesn't create links in headlines (<h1>
, <h2>
, ...) by default. It can be overridden by the option avoid_headlines:
If no protocol is specified in a future link (e.g. www.example.com
), should LinkFinder prefer https over http? It can be set by the option prefer_https
. The default value is true. There is also a constant LINK_FINDER_PREFER_HTTPS
to change the default behaviour in the global scope.
If prefer_https
is set to false, a list of secured websites can be specified in the option secured_websites
:
If the secured_websites option is omitted and https protocol is active, the current HTTP host () will be added automatically.
Long URLs shortening
Long URLs are automatically shortened to a maximum of 70 characters. For example, the following URL:
will be converted to:
If the shortening is not desired behaviour, option shorten_long_urls should be set to false:
Installation
Just use the Composer:
composer require yarri/link-finder
Testing
The LinkFinder is tested automatically using Travis CI in PHP 5.6 to PHP 8.3.
For the tests execution, the package atk14/tester is used. It is just a wrapping script for phpunit/phpunit.
Install required dependencies for development:
composer update --dev
Run tests:
cd test
../vendor/bin/run_unit_tests
License
LinkFinder is free software distributed under the terms of the MIT license