PHPackages                             cocochepeau/yourls-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. cocochepeau/yourls-php-sdk

ActiveLibrary[API Development](/categories/api)

cocochepeau/yourls-php-sdk
==========================

A PHP SDK for interacting with the YOURLS API, enabling URL shortening, expansion, and statistics retrieval.

0.1.3(1y ago)381[1 PRs](https://github.com/cocochepeau/yourls-php-sdk/pulls)GPL-3.0-or-laterPHPCI passing

Since Aug 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cocochepeau/yourls-php-sdk)[ Packagist](https://packagist.org/packages/cocochepeau/yourls-php-sdk)[ RSS](/packages/cocochepeau-yourls-php-sdk/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

YourlsSDK
=========

[](#yourlssdk)

Installation
------------

[](#installation)

```
composer require cocochepeau/yourls-php-sdk
```

Example Usage
-------------

[](#example-usage)

```
// Initialize the SDK
$yourls = new \Cocochepeau\YourlsPhpSdk\YourlsSDK('http://sho.rt/yourls-api.php', 'your_username', 'your_password');

// Create a short URL
try {
    $shortUrl = $yourls->createShortUrl('http://example.com', 'custom-keyword', 'Example Title');
    echo "Short URL: $shortUrl\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

// Expand a short URL
try {
    $longUrl = $yourls->expandShortUrl('custom-keyword');
    echo "Long URL: $longUrl\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

// Get stats for a specific short URL
try {
    $stats = $yourls->getUrlStats('custom-keyword');
    print_r($stats);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

// Get global stats
try {
    $dbStats = $yourls->getDbStats();
    print_r($dbStats);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72.7% 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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

676d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2019778?v=4)[sykz42](/maintainers/cocochepeau)[@cocochepeau](https://github.com/cocochepeau)

---

Top Contributors

[![sykz42](https://avatars.githubusercontent.com/u/113334184?v=4)](https://github.com/sykz42 "sykz42 (8 commits)")[![cocochepeau](https://avatars.githubusercontent.com/u/2019778?v=4)](https://github.com/cocochepeau "cocochepeau (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cocochepeau-yourls-php-sdk/health.svg)

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

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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