datana-gmbh / url-shortener-api
UrlShortener 的 API
1.2.0
2023-10-06 11:31 UTC
Requires
- php: >=8.1
- oskarstark/trimmed-non-empty-string: ^1.0
- psr/log: ^2.0 || ^3.0
- symfony/http-client: ^6.2.9
- thecodingmachine/safe: ^2.5
- webmozart/assert: ^1.11
Requires (Dev)
- ergebnis/composer-normalize: ^2.30.2
- ergebnis/php-cs-fixer-config: ^5.5
- ergebnis/test-util: ^1.6
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10.14
- phpstan/phpstan-webmozart-assert: ^1.2.4
- phpunit/phpunit: ^9.6.7
- thecodingmachine/phpstan-safe-rule: ^1.2
This package is auto-updated.
Last update: 2024-08-30 00:20:34 UTC
README
用法
安装
composer require datana-gmbh/url-shortener-api
设置
use Datana\UrlShortener\Api\UrlShortenerClient; $baseUri = 'https://url-shortner.datana.app'; $username = '...'; $password = '...'; $client = new UrlShortenerClient($baseUri, $username, $password);
生成短链接
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