riidme/laravel
最新稳定版本:v1.0.0
Composer 安装命令:
composer require riidme/laravel
包简介
Laravel integration for riid.me URL shortener service
README 文档
README
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.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-02-21