urlr / urlr-php
PHP client for URLR
1.1.0
2024-02-13 12:51 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.4.5
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- overtrue/phplint: ^9.0
- phpunit/phpunit: ^9.0
README
This SDK is automatically generated with the OpenAPI Generator project.
- API version: 0.3
- Package version: 1.1.0
- Build package: urlr/urlr-php
For more information, please visit https://urlr.me/en
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require urlr/urlr-php
Manual Installation
Download the files and include autoload.php
:
<?php require_once('/path/to/URLR/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Authentification $authentificationApi = new URLR\Api\AuthentificationApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $authentificationRequest = new \URLR\Model\AuthentificationRequest([ 'username' => '', 'password' => '', ]); // \URLR\Model\AuthentificationRequest | Your credentials try { $token = $authentificationApi->authentification($authentificationRequest)->getToken(); } catch (Exception $e) { echo 'Exception when calling AuthentificationApi->authentification: ', $e->getMessage(), PHP_EOL; exit; } $config = URLR\Configuration::getDefaultConfiguration()->setAccessToken($token); // Link shortening $linkApi = new URLR\Api\LinkApi(null, $config); $reduceLinkRequest = new \URLR\Model\ReduceLinkRequest([ 'url' => '', 'team' => '' ]); // \URLR\Model\ReduceLinkRequest | Infos of the link to reduce try { $result = $apiInstance->reduceLink($reduceLinkRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling LinkApi->reduceLink: ', $e->getMessage(), PHP_EOL; }
A complete example is available here.
API Endpoints
All URIs are relative to https://urlr.me/api
Class | Method | HTTP request | Description |
---|---|---|---|
AuthentificationApi | authentification | POST /login_check | Get an access token |
FolderApi | folder | GET /folder | Get folders of team |
LinkApi | reduceLink | POST /reduce-link | Shorten a link |
StatsApi | stats | POST /stats | Get statistics of a link |
TeamApi | team | GET /team | Get teams of user |
Models
- Authentification200Response
- Authentification401Response
- AuthentificationRequest
- Folder200Response
- Folder200ResponseFoldersInner
- FolderRequest
- ReduceLink200Response
- ReduceLink400Response
- ReduceLinkRequest
- Stats200Response
- Stats400Response
- StatsRequest
- Team200Response
- Team200ResponseTeamsInner
Authorization
bearerAuth
- Type: Bearer authentication (JWT)
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Get help / support
Please contact contact@urlr.me and we can take more direct action toward finding a solution.