Skip to content

nicl/Silex-Autolink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silex-Autolink

A lightweight service provider for Silex which adds an autolink Twig extension.

Identifying URLs in strings is not easy. This is a rough and pragmatic first attempt. Feedback is welcome!

Useful information on autolinking can be found in this article by Martin Fowler (also check out the numerous comments) and also in the book Mastering Regular Expressions by Jeffrey Friedl.

Installation

Recommended installation is through composer. Just add the following to your composer.json file:

{
    "require": {
        "nicl/silex-autolink": "1.0.*"
    }
}

Usage

To use the service provider first register it:

$app->register(new AutolinkServiceProvider());

You can then use the autolink filter in Twig files. For example:

{{ 'Check out this site: http://example.com'|autolink }}

Tests

If you wish to run the tests you need to have PHPUnit installed. Then, from the silex-autolink root directory run:

phpunit

(You may need to adapt the phpunit command and paths depending on your configuration.)

About

A lightweight service provider for Silex which adds an autolink twig extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages