Skip to main content

Share token events

Share tokens grant short-lived, signed access to a download or version without exposing the canonical URL. Service\ShareToken\Manager issues, validates, and revokes them; these events fire at each transition.

Events

EventSignatureWhen
mc_dm_share_token_issued(ShareToken $token, Download $download, User $issuer)After a token is created and committed.
mc_dm_share_token_used(ShareToken $token, Download $download, ?Version $version, string $clientIp)After a token successfully grants access. $version is null when the token targets the download's current version generically.
mc_dm_share_token_revoked(ShareToken $token, ?User $by, string $reason)After a token is revoked. $by is null when the system revokes (expiry, max-uses reached). $reason is a short machine identifier — e.g. 'manual', 'expired', 'exhausted'.

Issued vs used

issued fires once. used fires every time the token grants access (subject to the token's max-use count). If you're tracking per-token attribution, listen to used and key on $token->token_id.

Example

public static function shareTokenUsed(
\MC\DownloadsManager\Entity\ShareToken $token,
\MC\DownloadsManager\Entity\Download $download,
?\MC\DownloadsManager\Entity\Version $version,
string $clientIp
)
{
// emit to your analytics pipeline
}