2017 © Pedro Peláez
 

library short-mongo-id

Generates a short string identifier from a Mongo object id value.

image

as3/short-mongo-id

Generates a short string identifier from a Mongo object id value.

  • Wednesday, July 13, 2016
  • by zarathustra323
  • Repository
  • 3 Watchers
  • 4 Stars
  • 9,001 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Short Mongo ID for PHP

Generates a short string identifier from a MongoId value., (*1)

This repository is a PHP port of the npm/javascript library created by treygriffith. The usage and preamble of the following documentation is taken from that repository and modified for use with PHP. The original repo can be found here: https://github.com/treygriffith/short-mongo-id, (*2)

========, (*3)

Id's are generated from the timestamp and counter of the MongoDB Id, with some slight variation. They should be reasonably unique., (*4)

This is, unfortunately, a one-way function. It will reliably produce the same short id for the same MongoDB Id, but the operation can't be reversed (it is missing information about the machine id, process id, and most of the counter)., (*5)

Install

Use Composer:, (*6)

$ composer require as3/short-mongo-id

Usage

Pass a PHP MongoId object (or a string that can be converted to one) and it will return a reasonably unique short id made of [-_a-zA-Z0-9]., (*7)

use As3\ShortMongoId\Shortener;

$shortener = new Shortener();
$shortId   = $shortener->shorten('507f191e810c19729de860ea'); // returns "iTxuMF"

License

MIT (see License), (*8)

The Versions

13/07 2016

dev-master

9999999-dev

Generates a short string identifier from a Mongo object id value.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Jacob Bare

13/07 2016

v1.0

1.0.0.0

Generates a short string identifier from a Mongo object id value.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Jacob Bare