leadthread/laravel-shortener
Composer 安装命令:
composer require leadthread/laravel-shortener
包简介
README 文档
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;
统计信息
- 总下载量: 10.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-20