lighturl/lighturl

开源 URL 短链接工具

1.0.3 2016-10-05 21:01 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:53:00 UTC


README

开源 URL 短链接工具

Build Status

需求

  • PHP 5.6.4+

安装

通过 Composer 安装

$ composer require lighturl/lighturl

数据库迁移

使用 Phinx PHP 数据库迁移

edit phinx.yml
$ phinx migrate -e <development - production - testing>

文档

即将推出

快速开始

require 'vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as Capsule;
use LightUrl\LightUrl;
$capsule = new Capsule;

        $capsule->addConnection([
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'lighturl',
            'username'  => 'root',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ]);

        // Make this Capsule instance available globally via static methods... (optional)
        $capsule->setAsGlobal();

// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
        $capsule->bootEloquent();

        $connection=$capsule->getConnection();
$light = new LightUrl($connection);

if(isset($_GET['shortkey'])){

     $light->redirectTo($_GET['shortkey']);

}else {

$key = $light->lighten($heavyUrl);

echo $key;
}

变更日志

每个版本的详细变更记录在 发布说明 中。

许可协议

MIT