使用Bitly API创建短URL的库

1.0.0 2017-10-18 09:24 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:40:53 UTC


README

使用Bitly API在Laravel中创建短URL

如何安装

  • 在终端中运行
$ cd yourprojectdirectory
$ composer require arisharyanto/bitlys
  • 在config/app.php中添加服务提供者
Arisharyanto\Bitlys\BitlysServiceProvider::class,
  • 在终端中运行此命令
$ php artisan vendor:publish --provider="Arisharyanto\Bitlys\BitlysServiceProvider"  
  • 在config/bitlys.php中添加来自你的bitly应用的access_token
'access_token' => 'your access token',

如何使用

只需添加 use Arisharyanto\Bitlys\Bitlys

Bitlys::shorten($longUrl);  # Create short bitly url
Bitlys::expand($shortUrl);  # Convert shortUrl to longUrl
Bitlys::clicks($shortUrl);  # Returns the number of clicks on a single Bitlink
Bitlys::countries($shortUrl);  # Returns metrics about the countries referring click traffic to a single Bitlink

简单!

谁在使用Bitlys

许可证

查看许可证 https://github.com/Aris-haryanto/Bitlys-Laravel/blob/master/LICENSE

作者

Aris Haryanto 访问我的网站 https://arindasoft.wordpress.com/