When a user logs out, his identified session should end. This is well implemented in JS: https://posthog.com/docs/product-analytics/identify#reset
Sadly it's not yet available server-side, while it would be a great (and the best) place to do that.
Typically the validated log-out is handled server-side, ending the user session. We should then be able to also reset the session server-side, using the $distinctId parameter.
Something like this:
/**
* End the identified session.
*
* @param string $distinctId
* @param bool $resetDeviceId
* @return bool whether the reset call succeeded
*/
public function reset(string $distinctId, bool $resetDeviceId)
{
return $this->consumer->reset($distinctId, $resetDeviceId);
}