Build a PHP api that doesn’t require constant requests

So I am working to build an IP in PHP. I’m using Fetch method in Javascript to get the response. When something changes on server, it need to send a response to JS. To do this I was using setInterval() and repeat each second. These are too much requests. Is there any better way to do it?