定制 leela/urlshortnerapi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

leela/urlshortnerapi

最新稳定版本:v1.4

Composer 安装命令:

composer require leela/urlshortnerapi

包简介

URL Shortner API

README 文档

README

URL Shortner API shortens the url with Google short service and also TinyUrl shortening service.

It takes the long url and converts it into the short url.

Uses Strategy Design Pattern

It also takes the short url and sends the statistics and also the long url.

Begin by installing this package through Composer. Edit your project's composer.json file to require`.

"require": {
"leela/urlshortnerapi": "1.1"
}

Next, update Composer from the Terminal:

composer update

That's it! You're all set to go.

Usage for tiny url Shorten

<?php

$tinyUrlInstance = new \Leela\services\TinyUrlShortner(TINYURL_API_KEY);
$urlshortner = new Leela\UrlShortner($tinyUrlInstance);
try {
    echo $urlshortner->getLongUrl($shortUrl, $total_options);
    echo $urlshortner->getShortUrl($longUrl);
} catch (Exception $e) {
    echo $e->getMessage();
}

Usage for Google url Shorten

<?php

$googleUrlInstance = new \Leela\services\GoogleUrlShortner(Google_API_KEY);
$urlshortner = new Leela\UrlShortner($googleUrlInstance);
try {
    echo $urlshortner->getLongUrl($shortUrl, $total_options);
    echo $urlshortner->getShortUrl($longUrl);
} catch (Exception $e) {
    echo $e->getMessage();
}

Methods

getLongUrl($shortUrl, $total_options);

$shortUrl = Google Shorten Url or tiny shorten url

$total_options = TRUE or FALSE;
TRUE returns all the history list of the url
FALSE returns only the public url;


getShortUrl($longUrl)
$longUrl - The actual url need to be shorten;

Contributor

Leela Narasimha Reddy - leela@leelag.com

Issues & Suggestions

Please report any bugs or feature requests here: https://github.com/leelanarasimha/UrlShortnerApi/issues

统计信息

  • 总下载量: 1.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-01