lighturl/lighturl

Open Source Url Shortener

1.0.3 2016-10-05 21:01 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:34:46 UTC


README

Open Source Url Shortener

Build Status

Requirements

  • PHP 5.6.4+

Installation

Via Composer Install

$ composer require lighturl/lighturl

Database Migration

use Phinx PHP Database Migrations

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

Docs

Coming soon

Quick Start

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;
}

Changelog

Details changes for each release are documented in the release notes.

License

MIT