1. Go to this page and download the library: Download neuralpin/notifyli library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
neuralpin / notifyli example snippets
Neuralpin\Notifyli\Services\RedisMessageBroker;
// Initialize broker
$broker = new RedisMessageBroker(
enabled: true,
host: '127.0.0.1',
port: 6379,
password: null
);
// Send notification to specific user
$broker->publish(
userId: 123,
room: '/user/123', // Private notification channel
message: 'Your order #12345 has been shipped!',
from: 'OrderSystem'
);
// Check if user is currently connected
if ($broker->isUserConnected(123, '/user/123')) {
echo "User is online - notification delivered\n";
} else {
echo "User is offline - notification queued\n";
}