antikirra/udp-pool

0.0.2 2025-02-16 14:34 UTC

This package is auto-updated.

Last update: 2025-04-16 15:09:36 UTC


README

Packagist Dependency Version Packagist Version

UDP Pool is a lightweight PHP wrapper for managing multiple UDP connections. Its intuitive API lets you register endpoints using unique keys, IP addresses, and ports. Embracing the nature of UDP, it doesn't handle retransmissions or error corrections, making it ideal for logging, event tracking, and statistics collection.

Install

composer require antikirra/udp-pool:^0.0.2

Basic usage

<?php

require __DIR__ . '/vendor/autoload.php';

$client = new \Antikirra\UdpPool\Client();

$client->add('logs', '127.0.0.1', 9081);
$client->add('stats', '127.0.0.1', 9082);

$client->send('logs', '66.249.65.159 - - [06/Nov/2014:19:10:38 +0600] "GET /news/53f8d72920ba2744fe873ebc.html HTTP/1.1" 404 177 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"');
$client->send('stats', '66.249.65.159;1739716182;1;0;1;0;0');

$client->remove('logs');
$client->remove('stats');