2017 © Pedro Peláez
 

library concise

Concise your urls via extern providers

image

toin0u/concise

Concise your urls via extern providers

  • Friday, March 11, 2016
  • by mark.sagikazar
  • Repository
  • 2 Watchers
  • 0 Stars
  • 50 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Concise

Latest Version Software License Build Status Code Coverage Quality Score HHVM Status Total Downloads SensioLabsInsight, (*1)

Concise your urls via extern providers :), (*2)

Install

Via Composer, (*3)

``` bash $ composer require toin0u/concise, (*4)



## Usage Simple example using `Google` provider: ``` php 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., (*5)

Currently supported providers:, (*6)

  • Bitly
  • Google
  • Tinycc

Provider chaining

You can shorten a URL using multiple providers at once., (*7)

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., (*8)

``` php use Concise\Concise; use Concise\Provider\Chain;, (*9)

$chain = new Chain;, (*10)

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

$concise = new Concise($chain);, (*12)



### 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](http://www.stashphp.com/) first: ``` bash $ composer require tedivm/stash

``` php use Concise\Concise; use Concise\Provider\Cache; use Stash\Pool;, (*13)

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



## Testing ``` bash $ phpspec run

Contributing

Please see CONTRIBUTING for details., (*15)

Credits

License

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

The Versions

11/03 2016

dev-master

9999999-dev https://github.com/toin0u/concise

Concise your urls via extern providers

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márk Sági-Kazár

api url shorten shortener

10/03 2016

dev-psr6

dev-psr6 https://github.com/toin0u/concise

Concise your urls via extern providers

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márk Sági-Kazár

api url shorten shortener

10/03 2016

dev-header

dev-header https://github.com/toin0u/concise

Concise your urls via extern providers

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márk Sági-Kazár

api url shorten shortener

17/12 2014

v0.1

0.1.0.0 https://github.com/toin0u/concise

Concise your urls via extern providers

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

api url shorten shortener