leadthread / laravel-shortener by tylercd100

10,159
5
2
Package Data
Maintainer Username: tylercd100
Maintainer Contact: tylercd100@gmail.com (Tyler Arbon)
Package Create Date: 2016-04-03
Package Last Update: 2021-12-17
Language: PHP
License: MIT
Last Refreshed: 2024-12-13 15:01:58
Package Statistics
Total Downloads: 10,159
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 5
Total Watchers: 2
Total Forks: 2
Total Open Issues: 0

laravel-shortener

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;