I am new to php.I want to build a token based authentication in php without using any external library which generates a token and make it valid for 10 days so that I can pass that token to anybody and they can access certain api by passing token in url parameter.
I am able to generate a token but don't know how to make it valid for 10 days after that it will expire. And user will not be able to access it further. This is how I am generating token.
$token = bin2hex(random_bytes(16));
Any help would be appreciated.