How to copy data to clipboard in PHP
When you click the "Copy link" span element, it will call the copy() function which will then write the value of the hidden input (with the id of 'link-to-copy') to the clipboard of your navigator.
The value of the hidden input can be whatever you want, here I am using a PHP variable.
function copy() {
navigator.clipboard.writeText($('#link-to-copy').val());
}