An easy to use PHP implementation of Google's URL Shortener API
This project aims provide an easy to use implementation of the Google URL shortener API for PHP developers.
Install badams/google-url
using Composer.
$ composer require badams/google-url
use badams\GoogleUrl\GoogleUrl;
$url = new GoogleUrl('YOUR_API_KEY_HERE');
// Shorten
echo $url->shorten('https://github.com')->id;
> https://goo.gl/un5E
// Expand
echo $url->expand($short->id)->longUrl;
> https://github.com;
GoogleUrl is open-sourced software licensed under the MIT License (MIT). Please see LICENSE for more information.