rezzza / shorty
Underwear for your long urls
Installs: 14 849
Dependents: 1
Suggesters: 0
Security: 0
Stars: 12
Watchers: 7
Forks: 2
Open Issues: 3
Requires
- php: >=5.3.3
- symfony/property-access: ~2.2|~3.0
Requires (Dev)
- atoum/atoum: ~2.0
- guzzle/guzzle: 3.*
Suggests
- guzzle/http: Guzzle HTTP Adapter
This package is not auto-updated.
Last update: 2024-11-09 15:23:00 UTC
README
Underwear for your long urls
Installation
Use Composer to install: rezzza/shorty
.
In your composer.json you should have:
{ "require": { "rezzza/shorty": "1.0.*" } }
Requirements
Shorty requires Guzzle.
Usage
Example with the Google shortener:
$googleShortener = new \Rezzza\Shorty\Provider\Google(); $googleShortener->setHttpAdapter(new \Rezzza\Shorty\Http\GuzzleAdapter()); // or // $googleShortener->setHttpAdapter(new \Rezzza\Shorty\Http\CurlAdapter()); $shortUrl = $googleShortener->shorten('http://www.verylastroom.com/'); $longUrl = $googleShortener->expand('http://goo.gl/YY5Tz');
Example with the Chain shortener:
$chainShortener = new \Rezzza\Shorty\Provider\Chain(); $chainShortener->addProvider($googleShortener); // see example above $chainShortener->addProvider($bitlyShortener); $shortUrl = $chainShortener->shorten('http://www.verylastroom.com/'); $longUrl = $chainShortener->expand('http://goo.gl/YY5Tz');
Unit Tests
You can run tests with:
bin/atoum -d tests/units
Release notes
1.1.0
- Added Chain provider.
1.0.0
- Added Google Url Shortener.
- Added Bitly Url Shortener.
- Added Curl Http adapter.