为 Laravel 8 编写的 shorte.st 包装器

dev-master 2021-08-30 13:53 UTC

This package is auto-updated.

Last update: 2024-09-29 06:03:08 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

安装

首先,通过 Composer 引入此包。

composer require appsketch/shortest

然后,如果您使用 Laravel 5.1,请在 app/config/app.php 中包含服务提供者。

'providers' => [
    Appsketch\Shortest\Providers\ShortestServiceProvider::class,
]

如果您使用 Laravel 5,请包含此服务提供者。

'providers' => [
    "Appsketch\Shortest\Providers\ShortestServiceProvider",
]

别名将自动设置。

使用以下命令将配置文件发布到配置文件夹:php artisan vendor:publish

填写配置文件。

用法

例如,在 routes.php 中添加以下内容。

Route::get('/shortest', function()
{
    // this will for example echo http://sh.st/v0v8m.
    echo Shortest::link("http://www.google.com/");
});