PHPackages                             dmitrypro77/tinysrc-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dmitrypro77/tinysrc-php-sdk

ActiveProject[API Development](/categories/api)

dmitrypro77/tinysrc-php-sdk
===========================

PHP SDK for TinySRC

10PHP

Since Dec 13Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/dmitrypro77/tinysrc-php-sdk)[ Packagist](https://packagist.org/packages/dmitrypro77/tinysrc-php-sdk)[ RSS](/packages/dmitrypro77-tinysrc-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

TinySRC PHP SDK
===============

[](#tinysrc-php-sdk)

This is a PHP package for accessing [TinySRC API](http://api.tinysrc.me/).

[![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

What is TinySRC?
----------------

[](#what-is-tinysrc)

Free Tiny URL Shortener Service with a detailed statistic and extended features.

How to get Started
------------------

[](#how-to-get-started)

To get started working with TinySRC PHP SDK, you need register and get your personal API Key first.

Installing TinySRC-PHP-SDK
--------------------------

[](#installing-tinysrc-php-sdk)

The recommended way to install tinysrc-php-sdk is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of tinysrc-php-sdk:

```
composer.phar require dmitrypro77/tinysrc-php-sdk
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

You can then later update tinysrc-php-sdk using Composer:

```
composer.phar update
```

How to use TinySRC PHP SDK
--------------------------

[](#how-to-use-tinysrc-php-sdk)

This SDK follow by [PSR-18](https://www.php-fig.org/psr/psr-18/) (HTTP Client) specification, therefore you can use any client which implement ClientInterface: Guzzle, Symfony HttpClient etc...

Guzzle example:

```
$httpClient = new \GuzzleHttp\Client();

// Keep your API key safe and we strongly recommend use env variables to store api key
$client = new \Tinysrc\Client($httpClient, 'YOUR_API_KEY');
```

OR

Symfony HttpClient example:

```
$httpClient = new \Symfony\Component\HttpClient\Psr18Client();

// Keep your API key safe and we strongly recommend use either env variables or database to store api key
$client = new \Tinysrc\Client($httpClient, 'YOUR_API_KEY');
```

### Get List URL

[](#get-list-url)

```
$linkRepository = new \Tinysrc\Repository\LinkRepository($tinyClient);
// not required params $limit, $page, $query (search by hash, link etc...)
$response = $linkRepository->find(10, 1, '');

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

/** @var \Tinysrc\Response\LinkResponse $result */
$result = $response->getData();
var_dump($result->getData()); // data
var_dump($result->getTotal()); // total record

/** @var \Tinysrc\Response\LinkItemResponse $link */
foreach ($result->getData() as $link) {
    echo $link->getUrl().PHP_EOL;
    if ($link->isAuthRequired()) {
        echo $link->getPassword().PHP_EOL;
    }
    echo $link->getStatUrl().PHP_EOL;
    echo $link->getStatPassword().PHP_EOL;
}
```

### Create shortened url

[](#create-shortened-url)

```
$linkRepository = new \Tinysrc\Repository\LinkRepository($tinyClient);
$link = new \Tinysrc\Model\Link();
$link->setUrl("http://test.com");
$link->setPassword("test"); // optional
$link->setAuthRequired(true); // optional
$date = new DateTime("tomorrow");
$link->setExpirationTime($date->format("Y-m-d H:i")); // optional

$response = $linkRepository->add($link);

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

/** @var \Tinysrc\Response\LinkItemResponse $result */
$result = $response->getData();

echo $result->getUrl().PHP_EOL; // tiny url
echo $result->getPassword().PHP_EOL;
echo $result->getStatUrl().PHP_EOL;
echo $result->getStatPassword().PHP_EOL;
```

### Find Details By Hash

[](#find-details-by-hash)

```
$linkRepository = new \Tinysrc\Repository\LinkRepository($tinyClient);

$response = $linkRepository->findByHash("hash");

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

/** @var \Tinysrc\Response\LinkItemDetailedResponse $result */
$result = $response->getData();
echo $result->getUrl().PHP_EOL; // tiny url
echo $result->isActive().PHP_EOL;
echo $result->isAuthRequired().PHP_EOL;
echo $result->getBots().PHP_EOL;
echo $result->getClicks().PHP_EOL;
echo $result->getQrCode().PHP_EOL;
echo $result->getPassword().PHP_EOL;
echo $result->getStatUrl().PHP_EOL;
echo $result->getStatPassword().PHP_EOL;
```

### Activate/Deactivate Link

[](#activatedeactivate-link)

```
$linkRepository = new \Tinysrc\Repository\LinkRepository($tinyClient);

// Activate
$response = $linkRepository->activate("hash");

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

// Deactivate
$response = $linkRepository->deactivate("hash");

if (!$response->isSuccess()) {
    // Errors Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}
```

### Current User Info

[](#current-user-info)

```
$userRepository = new \Tinysrc\Repository\UserRepository($tinyClient);

// Activate
$response = $userRepository->current();

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

/** @var \Tinysrc\Response\UserResponse $result */
$result = $response->getData();

echo $result->isActive();
echo $result->getUsername();
echo $result->getEmail();
echo $result->getApiKey();
echo $result->getPlan();
echo $result->isBanned();
```

### Statistics by hash

[](#statistics-by-hash)

```
$statRepository = new \Tinysrc\Repository\StatRepository($tinyClient);

$response = $statRepository->findByHash("test");

if (!$response->isSuccess()) {
    // Error Happened
    var_dump($response->getErrors()); // Errors
    var_dump($response->getValidations()); // Validations Errors
}

/** @var \Tinysrc\Response\StatResponse $result */
$result = $response->getData();

echo $result->getTotal(); // total record

/** @var \Tinysrc\Response\StatItemResponse $stat */
foreach ($result->getData() as $stat) {
    echo $stat->getBrowser().PHP_EOL;
    echo $stat->getBrowserVersion().PHP_EOL;
    echo $stat->getPlatform().PHP_EOL;
    echo $stat->getOs().PHP_EOL;
    echo $stat->getIp().PHP_EOL;
    echo $stat->getReferer().PHP_EOL;
}
```

Dependencies
------------

[](#dependencies)

- PHP &gt;=7.3
- ext-json

Contributing
------------

[](#contributing)

Please note that this package still is in development.

**Pull requests are welcome**.

Links
-----

[](#links)

-

License
-------

[](#license)

\[MIT\]

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance50

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14866864?v=4)[Dmitry Budoragin](/maintainers/dmitrypro77)[@dmitrypro77](https://github.com/dmitrypro77)

---

Top Contributors

[![dmitrypro77](https://avatars.githubusercontent.com/u/14866864?v=4)](https://github.com/dmitrypro77 "dmitrypro77 (3 commits)")[![alietech](https://avatars.githubusercontent.com/u/203386047?v=4)](https://github.com/alietech "alietech (1 commits)")

### Embed Badge

![Health badge](/badges/dmitrypro77-tinysrc-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/dmitrypro77-tinysrc-php-sdk/health.svg)](https://phpackages.com/packages/dmitrypro77-tinysrc-php-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M479](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M271](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
