Skip to content

datana-gmbh/url-shortener-api

Repository files navigation

url-shortener-api

Branch PHP
master PHP

Usage

Installation

composer require datana-gmbh/url-shortener-api

Setup

use Datana\UrlShortener\Api\UrlShortenerClient;

$baseUri = 'https://url-shortner.datana.app';
$username = '...';
$password = '...';

$client = new UrlShortenerClient($baseUri, $username, $password);

Generate short URL

use Datana\UrlShortener\Api\UrlShortenerApi;
use Datana\UrlShortener\Api\UrlShortenerClient;

$client = new UrlShortenerClient(/* ... */);

$api = new UrlShortenerApi($client);
$response = $api->generateShortUrl('https://www.google.com');

$response->getShortUrl(); // returns sth. like https://......./12DDFFS3