This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The Identifier helper creates alphanumeric identifiers that can be useful when someone unique is desired, but a numeric key is too simplistic.

Loading the Helper

$id = Loader::helper(‘validation/identifier’);


$identifier = $id->generate($dbTable, $dbTableKey, $length = 12, $lowercase = false)

Generates a unique identifier for an item in a database table. Used, among other places, in generating user hashes for email validation, other URL-based validation, mail importers, etc… $dbTable is the table to check to ensure that this hash has not already been created, and $dbTableKey is the specific column within the table.

$identifier = $id->generate(‘UserValidationHashes’, ‘uHash’, 64)

$id->generateFromBase($string, $dbTable, $dbTableKey)

A useful function when you wish to ensure that $string doesn’t occur in the $dbTableKey found within $dbTable. This function will take a $string and append ever-increasing numbers to it until no matching string/number combination is found.

$identifier $id->getString($length = 12)

Returns a randomized hash of a specific length.

$id->deleteKey($dbTable, $dbTableKey, $hash)

Deletes from a hash table where the table key equals the specified hash.

Loading Conversation