Tiny PHP

Today, I'd like to annouce my new PHP Micro-Framework, Tiny.

Ha. Just kidding.

When I was building Forrst with Kyle, we knew that we didn't want to expose various primary keys, like post_ids, and user_ids, etc, on the site. The solution was to make URLs that looked like http://forrst.com/posts/Poly_Mantis-GFC.

We used a library from our friend, Jacob, that allowed us to obfuscate primary keys simply by base62 encoding them. I find myself using this library constantly, constantly copying and pasting from Kyle's github account, where the code has been sitting untouched for literally years. I finally made it composer-installable.

You can find it here. I hope you can find it as useful as I do.

edit: Just to clarify, the tiny-ified ID wasn't stored anywhere, it was always calculated. We used methods something like:

class Post {
    public function getUrl() {
      return $this->getSlug() . '-' . $this->getTinyId();

edit 2: This could also be used to build something like a URL shortener, as $tiny->to(99999999); would actually output jpWDw

comments powered by Disqus