zenapply/laravel-shortener

This package is abandoned and no longer maintained. The author suggests using the leadthread/laravel-shortener package instead.

6.0.1 2017-04-20 01:02 UTC

README

Latest Version Software License Build Status Scrutinizer Code Quality Code Coverage Dependency Status Total Downloads

Laravel Shortener is a simple package for shortening URL's through various online services.

Currently supported:

Installation

Install via composer - In the terminal:

composer require leadthread/laravel-shortener

Now add the following to the providers array in your config/app.php

LeadThread\Shortener\ShortenerServiceProvider::class

and this to the aliases array in config/app.php

"Shortener" => "LeadThread\Shortener\Facades\Shortener",

Then you will need to run these commands in the terminal in order to copy the config file

php artisan vendor:publish

Usage

First you must change your config file located at config/shortener.php with your API credentials Then you can simply shorten a URL like this:

$url = "https://github.com/leadthread/laravel-shortener";
$shortUrl = Shortener::shorten($url);
// (string) http://bit.ly/2amWdrE

Laravel Shortener also takes advantage or Laravel's caching features. Just simply edit your config file to change the caching variables.

Dont forget to add this to the top of the file

//If you updated your aliases array in "config/app.php"
use Shortener;
//or if you didnt...
use LeadThread\Shortener\Facades\Shortener;