toin0u/concise 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

toin0u/concise

Composer 安装命令:

composer require toin0u/concise

包简介

Concise your urls via extern providers

README 文档

README

Latest Version Software License Build Status Code Coverage Quality Score HHVM Status Total Downloads SensioLabsInsight

Concise your urls via extern providers :)

Install

Via Composer

$ composer require toin0u/concise

Usage

Simple example using Google provider:

use Concise\Concise;
use Concise\Provider\Google;
use Ivory\HttpAdapter\GuzzleHttpAdapter;

$concise = new Concise(new Google(new GuzzleHttpAdapter));

// Returns the shortened URL
$concise->shorten('http://any.url');

// Returns the expanded URL
$concise->expand('http://short.ly/1234');

For full list of available adapters check the official documentation.

Currently supported providers:

  • Bitly
  • Google
  • Tinycc

Provider chaining

You can shorten a URL using multiple providers at once.

Make sure to add the Providers in the chain in the SAME ORDER for both shortening and expanding. Expanding is automatically done in a reversed order.

use Concise\Concise;
use Concise\Provider\Chain;

$chain = new Chain;

$chain->addProvider(/* add a Provider instance here */);
$chain->addProvider(/* add another Provider instance here */);

$concise = new Concise($chain);

Caching

When working with lots of URLs it probably makes sense to cache already shortened/expanded URLs. This way you can avoid unnecessary HTTP requests.

To use caching install Stash first:

$ composer require tedivm/stash
use Concise\Concise;
use Concise\Provider\Cache;
use Stash\Pool;

$cache = new Cache(/* add a Provider instance here */, new Pool);
$concise = new Concise($cache);

Testing

$ phpspec run

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固