datana-gmbh/url-shortener-api

API for UrlShortener

1.2.0 2023-10-06 11:31 UTC

This package is auto-updated.

Last update: 2024-09-30 00:27:26 UTC


README

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