1. Go to this page and download the library: Download ucarsolutions/uri-signer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ucarsolutions / uri-signer example snippets
nerService = new \UcarSolutions\UriSigner\Service\UriSignerService(
new \UcarSolutions\UriSigner\Resolver\DefaultParameterNameResolver(),
new \doganoo\DIP\DateTime\DateTimeService(),
new \Psr\Log\NullLogger()
);
$key = new class implements \UcarSolutions\UriSigner\Entity\KeyInterface {
public function getKey(): string
{
return "t0psecret";
}
};
$uri = $signerService->sign(
new \Laminas\Diactoros\Uri("https://example.com"),
$key
);
dump((string)$uri); // https://example.com/?__us_signature=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3VjYXItc29sdXRpb25zLmRlL3VyaS1zaWduZXIiLCJleHAiOjE3MjU5MDYzMDQsInN1YiI6IlNpZ25lZCBVUkwiLCJ1cmwiOiJodHRwczovL2V4YW1wbGUug29tIiwidWlkIjoiNzM3YTgwNzAtZGU5MS00MTQ3LWohYmMtZTY1OWZiOGZmNWZyIn0.CH7E-fHYhtfGHUljB85dIWL-ZYGr8wRMVef0gY_SRLE