2017 © Pedro Peláez
 

library base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database.

image

service-to/base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database.

  • Saturday, January 30, 2016
  • by ServiceTo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database., (*1)

Usage

Install using composer...

composer require "service-to/base"

In a Laravel Controller

Route::get('{shortcode}', function ($shortcode) {
    $base = new ServiceTo\Base();
    return View::make("content")->withArticle(App\Article::find($base->base2int($shortcode)));
});

In plain old PHP

require_once("vendor/autoload.php");
use ServiceTo\Base;

function shorturl($url) {
    $myshortdomain = "http://short.long.urls.3.14159.xyz/";

    $base = new Base();
    $stmt = $pdo->prepare("INSERT INTO shorturls SET url=?");
    $stmt->bindValue(1, $url, PDO::PARAM_STR);
    $stmt->execute();

    return($myshortdomain . $base->int2base($stmt->lastInsertId()));
}

The Versions

30/01 2016

dev-master

9999999-dev https://github.com/ServiceTo/Base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

base62

30/01 2016

1.1.1

1.1.1.0 https://github.com/ServiceTo/Base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

base62

05/10 2015

1.1.0

1.1.0.0 https://github.com/ServiceTo/Base

Library to convert integers to base62 strings, useful for shortURLs based on ID numbers in a database.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

base62

30/09 2015

1.0.0

1.0.0.0 https://github.com/ServiceTo/Base

Library to convert decimals to base62 strings, useful for shortURLs based on ID numbers in a database.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

base62