PHP parser for messages conforming to the IRC protocol including support for IRCv3.2 Message Tags
Message without Message Tags.
$msg = new Lightircparser\IRCMessage(":[email protected] JOIN #test");
$msg->phrase();
echo $msg->to_json();
Output:
{
"ts": 1488459541399,
"has_message_tags": false,
"has_prefix": true,
"message_tags": [],
"prefix": {
"nick": "test",
"user": "test",
"host": "test.my.irc.server"
},
"command": "JOIN",
"params": [
"#test"
],
"raw": ":[email protected] JOIN #test"
}
Message with IRCv3.2 Message Tags.
$msg = new Lightircparser\IRCMessage("@display-name=TestUser;id=2362364236234634634;room-id=31462363463;sent-ts=1488375811149;admin=0;testp= :[email protected] PRIVMSG #test :Hello! World");
$msg->phrase();
echo $msg->to_json();
Output:
{
"ts": 1488460013762,
"has_message_tags": true,
"has_prefix": true,
"message_tags": {
"display-name": "TestUser",
"id": "2362364236234634634",
"room-id": "31462363463",
"sent-ts": "1488375811149",
"admin": "0",
"testp": null
},
"prefix": {
"nick": "testuser",
"user": "testuser",
"host": "testuser.my.irc.server"
},
"command": "PRIVMSG",
"params": [
"#test",
"Hello! World"
],
"raw": "@display-name=TestUser;id=2362364236234634634;room-id=31462363463;sent-ts=1488375811149;admin=0;testp= :[email protected] PRIVMSG #test :Hello! World"
}
I could not find a parser for PHP with message tags support so I made one.
composer require skycube/lightircparser
GPL-3.0