cuneytsenturk/laravel-url-shortener
最新稳定版本:1.0.3
Composer 安装命令:
composer require cuneytsenturk/laravel-url-shortener
包简介
Laravel URL Shortener
README 文档
README
Laravel URL Shortener is a simple and useful package that allows you to shorten URLs within the Laravel framework.
Features
- Shorten long URLs into short URLs
- Resolve short URLs back to their original URLs
- User-friendly interface
Installation
Requirements
- PHP 8.0 or higher
- Laravel 7.x or higher
Step 1: Install the Package
You can install this package via Composer:
composer require cuneytsenturk/laravel-url-shortener
Step 2: Configuration
To configure the package, publish the config file using the following command:
php artisan vendor:publish --provider="CuneytSenturk\UrlShortener\Provider"
Add alias if you want to use the facade.
'UrlShortener' => CuneytSenturk\UrlShortener\Facade::class,
Step 3: Database Migrations
Run the database migrations to create the necessary tables:
php artisan migrate
Usage
You can use the package's functions to perform URL shortening operations.
Shortening a URL
To shorten a URL:
use Cuneytsenturk\UrlShortener\Facade; $shortUrl = UrlShortener::encode('https://example.com/very/long/url'); echo $shortUrl;
Resolving a Short URL
To resolve a short URL back to its original URL:
use Cuneytsenturk\UrlShortener\Facade; $originalUrl = UrlShortener::decode($shortUrl); echo $originalUrl;
Testing
To run the tests that come with the package:
vendor/bin/phpunit
Contributing
If you would like to contribute, please send a pull request. All contributions are welcome.
License
This project is licensed under the MIT License. For more information, see the LICENSE file.
Contact
For questions or feedback, please contact Cüneyt Şentürk.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-02