Looking to hire Laravel developers? Try LaraJobs

laravel maintained by riidme

Description
Laravel integration for riid.me URL shortener service
Last update
2025/02/21 10:16 (dev-main)
Links
Downloads
3

Comments
comments powered by Disqus

Riid.me Laravel SDK

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.