agiledevelopment/url-shortener

A robust PHP SDK for shortening URLs via the 00x.dk API

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/agiledevelopment/url-shortener

v1.0.2 2025-10-30 23:17 UTC

This package is not auto-updated.

Last update: 2025-10-31 08:46:41 UTC


README

A lightweight and robust PHP SDK for shortening URLs using the
00x.dk API.

๐Ÿš€ Features

  • โœ… PHP 8.3+ compatible
  • โœ… PSR-4 autoloading
  • โœ… Input validation and robust error handling
  • โœ… Easy integration via Composer
  • โœ… Extensible for future endpoints (analytics, deletion, etc.)

๐Ÿ“ฆ Installation

If you're using this SDK in a private project, add the Bitbucket repository to your composer.json file:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "git@bitbucket.org:csriraj/url-shortener-sdk.git"
    }
  ],
  "require": {
    "agiledevelopment/url-shortener": "^1.0"
  }
}

Then run the following command:

composer install

๐Ÿงช Usage Example

use AgileDevelopment\Shortener;

try {
    $result = Shortener::create('your_api_token', 'https://www.example.com');
    echo "Shortened URL: " . $result['shortened_url'];
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

๐Ÿ” API Requirements

Endpoint:

POST https://00x.dk/api/v1/urls

Headers:

Authorization: Bearer <your_token>
Content-Type: application/json
Accept: application/json

Body:

{
  "url": "https://bitbucket.org/csriraj/url-shortener-sdk"
}

Successful Response:

{
  "shortened_url": "https://00x.dk/00xdk",
  "original_url": "https://bitbucket.org/csriraj/url-shortener-sdk",
  "code": "00xdk",
  "message": "URL shortened successfully!"
}

๐Ÿ“ License

This project is licensed under the MIT License.

Made with โค๏ธ by **Agile Development**