riidme/laravel

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

Laravel integration for riid.me URL shortener service

v1.0.0 2025-02-21 09:06 UTC

This package is auto-updated.

Last update: 2025-05-21 09:49:21 UTC


README

Latest Version on Packagist Tests Total Downloads

Laravel integration for the riid.me URL shortener service.

Requirements

  • PHP 8.3 or higher
  • Laravel 11.x

Installation

You can install the package via composer:

composer require riidme/laravel

After installing, publish the configuration file:

php artisan vendor:publish --tag="riidme-config"

Configuration

Add these environment variables to your .env file:

RIIDME_API_URL=https://riid.me
RIIDME_TIMEOUT=5
RIIDME_RETRIES=3

Usage

Using the Facade

use Riidme\Laravel\Facades\Riidme;

$shortUrl = Riidme::shorten('https://example.com/very/long/url');
echo $shortUrl->getShortUrl(); // https://riid.me/abc123
// or simply
echo $shortUrl; // https://riid.me/abc123

Using Dependency Injection

use Riidme\Laravel\RiidmeManager;

class UrlController
{
    public function __construct(
        private RiidmeManager $riidme
    ) {}

    public function shorten(Request $request)
    {
        $shortUrl = $this->riidme->shorten($request->url);
        
        return response()->json([
            'short_url' => $shortUrl->getShortUrl()
        ]);
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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