Tool for changing long links into short links.
长链接生成短链接 实现 短链跳转
- 发布配置文件
php artisan vendor:publish --provider="Chowjiawei\ShortLink\Providers\ShortLinkServiceProvider" - 执行迁移命令
php artisan migrate
- 引入服务(以下功能均需引入)
$shortLinkService=new \Chowjiawei\ShortLink\Services\ShortLinkService();- 系统自生成 新的短链接 支持:
mix混合number纯数字minLetter纯小写字母maxLetter纯大写字母
$shortLinkService->short('apple122','maxLetter');- 自定义新链接(短链接)
$shortLinkService->customShort('apple1111','apple123');- 删除关系链接(使用旧链接【长连接】进行删除)
$shortLinkService->deleteOldUrl('apple122');- 删除关系链接(使用新链接【短连接】进行删除) 这会删除全部相关的新链接
$shortLinkService->deleteNewUrl('apple122');- 使用跳转 建议放入Laravel(app\Http\Controller.php 的fallback方法内) ,路由(
Route::fallback('Controller@fallback');)
$shortLinkService=new \Chowjiawei\ShortLink\Services\ShortLinkService();
return $shortLinkService->redirect(); config文件夹内的short-link配置
enabled 为false即可暂停
forbid_prefix 可配置不可解析的前缀url