oleander / googl
PHP版的Google URL缩短器API
dev-master
2014-08-13 20:53 UTC
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: 3.*
This package is not auto-updated.
Last update: 2024-09-24 07:06:51 UTC
README
PHP版的Google URL缩短器API
使用方法
缩短URL
$client = new Googl\Base("username@gmail.com", "password"); $url = $client->shorten("http://www.bbc.co.uk/"); echo $url->short; # => "http://goo.gl/wZts"
您的URL现在可以在 http://goo.gl/ 上看到。
展开URL
$long = Googl\Base::expand("http://goo.gl/wZts"); echo $url->original; # => "http://www.bbc.co.uk/"
安装
不使用Composer
使用 git clone https://github.com/oleander/googl-php
克隆项目,并通过 require_once("googl-php/src/Googl.class.php");
包含源文件。
使用Composer
将以下JSON添加到您的 composer.json
文件中,并运行 composer update
。
{
"require" : {
"oleander/googl" : "dev-master"
}
}
测试
测试可以在 tests
文件夹中找到,通过运行 USER="username@gmail.com" PASSWORD="gmail-password" phpunit
执行。在运行测试套件之前,别忘了运行 composer update
。
贡献
- 分支它 ( http://github.com/oleander/googl-php/fork )
- 创建您的功能分支 (
git checkout -b my-new-feature
) - 提交您的更改 (
git commit -am 'Add some feature'
) - 推送到分支 (
git push origin my-new-feature
) - 创建新的Pull Request