mlopez/url-shortener
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mlopez/url-shortener
包简介
README 文档
README
This package implements a URL shortener in your Laravel project, using a migration and two access routes. It also comes with a configuration file to adjust what you consider necessary.
Installation
Use composer to install the package.
composer require mlopez/url-shortener
Optionally, you can publish the configuration file and the migration.
php artisan vendor:publish --tag=url-shortener-migrations
php artisan vendor:publish --tag=url-shortener-config
After composer installs the package, run the following command to run the migration and register the routes.
php artisan url-shortene:install
Test
public function test_url_shortener() { $this->post(route('links.store'), [ 'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers' ]); $this->assertDatabaseHas(config('urlshortener.table'), [ 'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers' ]); }
Response
{
"id": 16,
"long_url": "https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers",
"code": "5TPcKQ",
"short_url": "https://123url.com/5TPcKQ", 🏹
"updated_at": "2023-03-25T04:59:32.000000Z",
"created_at": "2023-03-25T04:59:32.000000Z"
}
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-25