2017 © Pedro Peláez
 

library url-shortener

A simple library to generate shortened URLs

image

andrzejkupczyk/url-shortener

A simple library to generate shortened URLs

  • Monday, July 2, 2018
  • by andrzejkupczyk
  • Repository
  • 0 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

URL Shortener

PHP requirementGitHub tag (latest SemVer)GitHub license Build statusCode quality, (*1)

A simple yet easily extendable library to generate shortened URLs using different providers., (*2)

Install

Via Composer, (*3)

composer require andrzejkupczyk/url-shortener

Examples of use

Creating short URLs

$shortener = UrlShortener::bitly($apiUri, $apiKey);

$link = $shortener->shorten(new Url('https://github.com/andrzejkupczyk/url-shortener'));

print($link->shortUrl()); // http://bit.ly/2Dkm8SJ

Expanding shortened URLs

$shortener = UrlShortener::bitly($apiUri, $apiKey);

$link = $shortener->expand(new Url('http://bit.ly/2Dkm8SJ'));

print($link->longUrl()); // https://github.com/andrzejkupczyk/url-shortener

Supported providers

Shortening Expanding Branding
Bitly ✔️ ✔️ ✔️
Firebase Dynamic Links ✔️ ❌ ✔️
TinyURL ✔️ ❌ ❌

Laravel support

It is possible to use this package easily within a Laravel >=5.5 application (it is configured for discovery)., (*4)

Artisan commands

url:expand {url}   Expand short URL
url:shorten {url}  Shorten long URL

Configuration (not required)

Publish and modify the configuration file:, (*5)

php artisan vendor:publish --provider="WebGarden\UrlShortener\LaravelServiceProvider"

The Versions