Interesting problem you have to solve there!
Here are some hints that can help you in the process. Don't have much time to do a complete solution because I'm at work.
What you basicaly have to do is:
1) Create a function/component which generates the encoded urls. Something like below:
$base = $this->config->site->url; // https://www.website.com/
$url = $this->url->get(['controller' => 'news', 'action' => 'view', 'id' => 3]); // https://www.website.com/news/view/3
$uri = explode($base, $url);
$uri = array_pop($uri); // news/view/3
$uriEncoded = \Helpers\Common::encodeString($uri); // mbDCG64IK1f7wx4dCI3l1NuMSGUAaY44ekuANNXaZsGoZK4DAC-_IpajJQFyZIEb-3Q55iO3w4YYV4RSKUEb8A==
$uriDecoded = \Helpers\Common::decodeString($uriEncoded); // news/view/3
I'm using Phalcon's Crypt class. Please note that encodeString will always generate a different value, which adds an extra layer of security. If you want same strings always, you have to use some other two-way encoding mechanism. See the encode functions below*.
2) Update your service file where you define the router. Catch the encoded string, decode it and pass to router;
3) You have to do some customizations of your app, but should not be much work.
*Encode functions:
private static $cryptKey = 'i$4^&/:%[email protected]<@{(e=*!<7u|rI~0';
/**
* Generate url safe encoded string
*
* @param string $string string to be encoded
* @return encoded string
*/
public static function encodeString($string)
{
$crypt = new \Phalcon\Crypt();
return $crypt->encryptBase64($string, self::$cryptKey, true);
}
/**
* Decode string generated with Common::encodeString()
*
* @param string $string Encoded string
* @return decoded string
*/
public static function decodeString($string)
{
$crypt = new \Phalcon\Crypt();
return $crypt->decryptBase64($string, self::$cryptKey, true);
}