src/Haikunator.php
public static function haikunate(array $params = [])
    {
        $defaults = [
            "delimiter"   => "-",
            "tokenLength" => 4,
            "tokenHex"    => false,
            "tokenChars"  => "0123456789",
        ];

        $params = array_merge($defaults, $params);

        if ($params["tokenHex"] == true) {
            $params["tokenChars"] = "0123456789abcdef";
        }

        $adjective = self::$ADJECTIVES[mt_rand(0, count(self::$ADJECTIVES) - 1)];
        $noun = self::$NOUNS[mt_rand(0, count(self::$NOUNS) - 1)];
        $token = "";

        for ($i = 0; $i < $params["tokenLength"]; $i++) {
            $token .= $params["tokenChars"][mt_rand(0, strlen($params["tokenChars"]) - 1)];
        }

        $sections = [$adjective, $noun, $token];
        return implode($params["delimiter"], array_filter($sections));
    }
public static function haikunate(array $params = [])
    {
        $defaults = [
            "delimiter"   => "-",
            "tokenLength" => 4,
            "tokenHex"    => false,
            "tokenChars"  => "0123456789",
        ];

        $params = array_merge($defaults, $params);

        if ($params["tokenHex"] == true) {
            $params["tokenChars"] = "0123456789abcdef";
        }

        $adjective = self::$ADJECTIVES[mt_rand(0, count(self::$ADJECTIVES) - 1)];
        $noun = self::$NOUNS[mt_rand(0, count(self::$NOUNS) - 1)];
        $token = "";

        for ($i = 0; $i < $params["tokenLength"]; $i++) {
            $token .= $params["tokenChars"][mt_rand(0, strlen($params["tokenChars"]) - 1)];
        }

        $sections = [$adjective, $noun, $token];
        return implode($params["delimiter"], array_filter($sections));
    }
Generate Heroku-like random names to use in your applications.

@param array $params Array containing the optinal parameters.
@return string