Download the PHP package nahid/linkify without Composer

On this page you can find all versions of the php package nahid/linkify. 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 linkify

Linkify

This a Linkify Laravel 5 supported package. Its converts URLs and email addresses into clickable links. It works on both snippets of HTML (or plain text) and complete HTML pages.

There are many regex variations shared on the internet for performing this task, but few are robust. Linkify contains a large number of unit tests to counter this.

It does not cover every possible valid-yet-never-used URLs and email addresses in order to handle 'real world' usage (eg no 'gopher://'). This means, for example, that it copes better with punctuation errors.

Authors

It uses regex based on John Gruber's Improved Liberal, Accurate Regex Pattern for Matching URLs.

Installation

  1. Add Linkify to your dependencies:

    // composer.json
    
    {
       // ...
       "require": {
           // ...
           "nahid/linkify": "1.1.*"
       }
    }
  2. Use Composer to download and install Linkify:

    $ php composer.phar update Nahid/linkify
  3. open config/app.php and in providers array add this line

    and in aliases array add this line too

  4. Open terminal and goto your project and run this command

Usage

    $text = 'This is my text containing a link to www.example.com.';

    echo Linkify::process($text);

Will output:

    This is my text containing a link to <a href="http://www.example.com">www.example.com</a>.

Options

Options set on the constructor will be applied to all links. Alternatively you can place the options on a method call. The latter will override the former.

    $linkify = new \Nahid\Linkify\Linkify(array('attr' => array('class' => 'foo')));
    $text = 'This is my text containing a link to www.example.com.';

    echo $linkify->process($text);

Will output:

    This is my text containing a link to <a href="http://www.example.com" class="foo">www.example.com</a>.

Whereas:

    $linkify = new \Nahid\Linkify\Linkify(array('attr' => array('class' => 'foo')));
    $text = 'This is my text containing a link to www.example.com.';

    echo $linkify->process($text, array('attr' => array('class' => 'bar')));

Will output:

    This is my text containing a link to <a href="http://www.example.com" class="bar">www.example.com</a>.

Available options are:

attr

An associative array of HTML attributes to add to the link. For example:

    array('attr' => array('class' => 'foo', 'style' => 'font-weight: bold; color: red;')

callback

A closure to call with each url match. The closure will be called for each URL found with three parameters: the url, the caption and a boolean isEmail (if $isEmail is true, then $url is equals to $caption.

If the callback return a non-null value, this value replace the link in the resulting text. If null is returned, the usual <a href="URL">CAPTION</a> is used.

    $linkify = new \Nahid\Linkify\Linkify(array('callback' => function($url, $caption, $isEmail) {
        return '<b>' . $caption . '</b>';
    }));
    echo $linkify->process('This link will be converted to bold: www.example.com.'));

All versions of linkify with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 nahid/linkify contains the following files

Loading the files please wait ....