h2akim/googl

Google URL Shortener API

1.0.1 2017-02-24 04:04 UTC

This package is not auto-updated.

Last update: 2024-11-08 19:23:09 UTC


README

Simple PHP library for Google URL Shortener API

Discontinuation

As Google's URL Shortener service will be discontinued on March 30, 2019, there is no new development of this package from now on. Thanks

Getting Started

Composer

composer require h2akim/googl:*

How to Use

Create a new shorten URL

Parameters available:

  • longUrl
  • object (optional) - return as object (if true)
namespace H2akim\Googl;

$googl = new Googl('your-api-key');

$googl->create([
    'longUrl' => 'http://url.that.you.want.com'
]);

Retrieve original url from shorten URL

Parameters available:

  • shortUrl
  • projection - ANALYTICS_CLICKS / ANALYTICS_TOP_STRINGS / FULL
  • object (optional) - return as object (if true)
namespace H2akim\Googl;

$googl = new Googl('your-api-key');

$googl->expand([
    'shortUrl' => 'http://goo.gl/short-url'
]);