LaravelPackages.net
Acme Inc.
Toggle sidebar
riidme/laravel

Laravel integration for riid.me URL shortener service

3
0
v1.0.0
About riidme/laravel

riidme/laravel is a Laravel package for laravel integration for riid.me url shortener service. It currently has 0 GitHub stars and 3 downloads on Packagist (latest version v1.0.0). Install it with composer require riidme/laravel. Discover more Laravel packages by riidme or browse all Laravel packages to compare alternatives.

Last updated

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.

Comments