Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.
/ googl-php Public archive

A PHP5 library to generate shortened URL through The Google URL Shortener API

License

Notifications You must be signed in to change notification settings

zero-archive/googl-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Googl

Build Status Latest Stable Version License

A PHP5 library to generate shortened URL through The Google URL Shortener API.

Usage

Using an Google API key is highly recommended. To acquire an API key follow the instructions.

Shorten URL

Shorten a long URL using The Google URL Shortener API

try {
    $googl = new \dotzero\Googl('YOUR_GOOGLE_API');
    echo $googl->shorten('http://github.com');
} catch (\dotzero\GooglException $e) {
    printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}

Expand URL

Expand a short URL using The Google URL Shortener API

try {
    $googl = new \dotzero\Googl('YOUR_GOOGLE_API');
    echo $googl->expand('http://goo.gl/KkZ8');
} catch (\dotzero\GooglException $e) {
    printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}

Install

Via composer:

$ composer require dotzero/googl

Without composer

Clone the project using git clone https://github.com/dotzero/googl-php/ and include the source file with require_once("googl-php/src/Googl.php");

Test

First install the dependencies, and after you can run:

GOOGLE_API=YOUR_GOOGLE_API vendor/bin/phpunit

License

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

About

A PHP5 library to generate shortened URL through The Google URL Shortener API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages