public static function generateCustom($prefix, $length=128) {

        if ( $length <= (strlen($prefix)+1) ) {
            throw new InvalidArgumentException("Uid length cannot be smaller than prefix length +1");

        }

        return "$prefix-".self::generate($length-(strlen($prefix)+1));

    }
public static function generateCustom($prefix, $length=128) {

        if ( $length <= (strlen($prefix)+1) ) {
            throw new InvalidArgumentException("Uid length cannot be smaller than prefix length +1");

        }

        return "$prefix-".self::generate($length-(strlen($prefix)+1));

    }
public static function generateCustom ( $ prefix , $ length = 128 ) { if ( $ length <= ( strlen ( $ prefix ) + 1 ) ) { throw new InvalidArgumentException ( "Uid length cannot be smaller than prefix length +1" ) ; } return "$prefix-" . self :: generate ( $ length - ( strlen ( $ prefix ) + 1 ) ) ; }
Generate a custom uid starting from a prefix

The result uid format will be $string-[random]

@param string $prefix
@param int $length
@return string
Generate a custom uid starting from a prefix