riidme/php-sdk

There is no license information available for the latest version (v1.0.0) of this package.

Official PHP SDK for riid.me URL shortener service

v1.0.0 2025-02-21 08:08 UTC

This package is auto-updated.

Last update: 2025-03-21 08:49:20 UTC


README

Latest Version on Packagist Tests Total Downloads

Official PHP SDK for the riid.me URL shortener service. This package provides a clean and simple way to interact with the riid.me API.

📦 Related Packages

🔧 Requirements

  • PHP 8.3 or higher
  • PSR-17 HTTP Factory implementation
  • PSR-18 HTTP Client implementation

📥 Installation

You can install the package via composer:

composer require riidme/php-sdk

🚀 Usage

use Riidme\Client;
use Riidme\Exception\RiidmeException;

// Initialize using factory method
$client = Client::create([
    'base_url' => 'https://riid.me',  // Optional
    'timeout'  => 5,                  // Optional
    'retries'  => 3                   // Optional
]);

try {
    $result = $client->shorten('https://example.com/very/long/url');
    echo $result->getShortUrl(); // https://riid.me/abc123
    // or simply
    echo $result; // https://riid.me/abc123
} catch (RiidmeException $e) {
    echo "Error: " . $e->getMessage();
}

🛠️ Laravel Integration

If you're using Laravel, check out our dedicated Laravel package riidme/laravel which provides:

  • Laravel service provider
  • Facade for convenient access
  • Laravel-specific configuration
  • Integration with Laravel's HTTP client
  • Automatic retry handling
  • Queue support

✅ Testing

composer test

🤝 Contributing

Please see CONTRIBUTING for details.

📄 License

The Apache2 License. Please see License File for more information.