leadthread / laravel-shortener
Installs: 10 157
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^5.4|^7.0
- illuminate/support: ^5.0
- leadthread/php-bitly: ^4.0
- leadthread/php-google-shortener: ^2.0
Requires (Dev)
- orchestra/testbench: ^3.1
- phpunit/phpunit: ^4.8 || ^5.0
This package is auto-updated.
Last update: 2024-10-17 14:08:33 UTC
README
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;