monster3d/php-url-shortener

v0.2 2016-10-02 04:55 UTC

This package is auto-updated.

Last update: 2024-09-29 04:20:10 UTC


README

Description:

This library for simple to take short url. Usind Google Shortener API.

Install this package with Composer

Require this package with Composer.

composer require monster3d/php-url-shortener

Or add your dependencies to composer.json file

"require": {
    "monster3d/php-url-shortener": "*"
    }

How to use:

<?php
//include composer
require __DIR__ . '/vendor/autoload.php';
use Monster3D\Shortener\Short;

//Set google api key
Short::setGoogleAPIKey('YOUR-GOOGLE-API-KEY');
$result = Short::link('http://mylongurl.ru/');
print_r($result);

in the var: $result will be stdClass object.

stdClass object
(
    [kind]    => urlshortener#url
    [id]      => https://goo.gl/VQ5T
    [longUrl] => http://mylongurl.ru/
)