To implement this feature use the Html5 Push API. Stay tuned for compatibility with browsers.
Another caution you must have is that PHP is not a good language for implementing daemons, that is, implementing websockets is a shot in the foot. PHP is designed for processes to start and end, keeping a process running will greatly increase the memory and processing usage of your server. Since PHP has no way to manage memory, you only have to rely on the garbage collector, which is a bad idea. (If you have any questions about this, here's an explanation link )
Although the Push API does not use websockets, keep this in mind, it is better to use another language if you want a real-time notification system. And also think about the situation that by working with workers, you will receive calls in short times from all users that enable this feature, which can weigh on your server due to the high number of processes that will be opened depending on the number of users of your site / system increases.
For example:
If your system has 100 users and notifications are checked every 5 seconds, the minimum request you will have is 100 / if 6000 / m adds this to the average number of visits on your site per minute and will have the total of executed processes. It will come to the conclusion that it is not a good thing to leave this type of resource in PHP's hand, since the processing used is very high.
So you will find few examples in PHP about features such as notifications.
Some PHP implementations
References: