tobymaxham / url-shortener
The offical UX9 URL Shortener API.
Installs: 1 214
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.5.9
- ext-curl: *
- ext-json: *
README
Official UX9 URL Shortener API. Visit ux9.de for more Details.
Installation
composer require tobymaxham/url-shortener
Usage
There are different ways how to get your short URL. If you are using Laravel than try out laravel-junkies/url-shortener. It's an Laravel Package where you simply can use this:
$url = Shortener::short('https://example.com');
Initialize
$shortener = new TobyMaxham\Ux9\Shortener($url = null, $config = null, $format = 'json'); // set the API Token $shortener->setToken('YOUR_API_TOKEN');
Where $url
can be a valid URL or an array containing URL's. The $format
is the output/return format you specified. If you don't enter a format it will take the specified format defined in the configuration Array or the 'json' format.
Get short URL
$shortener->out();
Short Version
$shortener->short('http://maxham.de'); $shortener->short('http://github.com');
Here you will always get the string of the short url.
Options and parameters
// default = json, alternativ plain, array $shortener->format($format); $shortener->out($format); $shortener->add($url);
Configuration
$config = [ 'API_TOKEN' => 'YOUR_API_TOKEN', 'FORMAT' => 'plain', ]; $shortener = new TobyMaxham\Ux9\Shortener($url = null, $config);