LaravelPackages.net
Acme Inc.
Toggle sidebar
div-art/shortlink

A Laravel 5.5 shortener package

11.315
4
0.2.4
About div-art/shortlink

div-art/shortlink is a Laravel package for a laravel 5.5 shortener package. It currently has 4 GitHub stars and 11.315 downloads on Packagist (latest version 0.2.4). Install it with composer require div-art/shortlink. Discover more Laravel packages by div-art or browse all Laravel packages to compare alternatives.

Last updated

ShortLink

Short Link package for Laravel 5.5

Installation

To install, run the following in your project directory:

$ composer require div-art/shortlink

Then in config/app.php add the following to the providers array:

\DivArt\ShortLink\ShortLinkServiceProvider::class,

Also in config/app.php, add the Facade class to the aliases array:

'ShortLink' => \DivArt\ShortLink\Facades\ShortLink::class,

Configuration

To publish ShortLink's configuration file, run the following vendor:publish command:

php artisan vendor:publish --provider="DivArt\ShortLink\ShortLinkServiceProvider"

This will create a shortlink.php in your config directory. Here you must enter your Shortener URL API Key.

Usage

Be sure to include the namespace for the class wherever you plan to use this library

use DivArt\ShortLink\Facades\ShortLink;

To shorten a URL:

$url = "https://www.google.com";

ShortLink::google($url);

// return https://goo.gl/Njku

To get stats of clicks on shortened URL:

$url = https://goo.gl/Njku;

ShortLink::clicks($url);

Methods

ShortLink::google(); // return shortener url like goo.gl/XXXXXX

ShortLink::bitly(); // return shortener url like bit.ly/XXXXXX

ShortLink::rebrandly(); // return shortener url like rebrand.ly/XXXXXX

ShortLink::clicks(); // return count of clicks on a shortener url

ShortLink::expand(); // return long url

Services

goo.gl

bit.ly

rebrand.ly

License

The MIT License (MIT). Please see License File for more information.

Star History Chart