UUID Universally Unique Identifiers

URL

Source Code

if ($this->request->method() === 'POST')
{
	$url = $this->request->post('url');

	if ( ! filter_var($url, FILTER_VALIDATE_URL))
	{
		// Not a valid URL
		$response = 'Invalid URL.';
	}
	else
	{
		// Generate the standard v5 UUID for this URL
		$uuid = UUID::v5(UUID::URL, $url);

		// Set the response
		$response = Debug::vars($uuid);
	}
}
else
{
	$url = 'http://';
}

$this->content = View::factory('demo/form')
	->set('message', 'Enter a URL to generate a v5 (sha1) UUID.')
	->set('inputs', array(
		'URL' => Form::input('url', $url),
	))
	->bind('footer', $response)
	;