Skip to content

PHP parser for messages conforming to the IRC protocol including support for IRCv3.2 Message Tags

License

Notifications You must be signed in to change notification settings

skycubeuk/lightircparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

PHP parser for messages conforming to the IRC protocol including support for IRCv3.2 Message Tags

Examples

Exmaple 1:

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"
}
Exmaple 2:

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"
}

Motivation

I could not find a parser for PHP with message tags support so I made one.

Installation

composer require skycube/lightircparser

License

GPL-3.0

About

PHP parser for messages conforming to the IRC protocol including support for IRCv3.2 Message Tags

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages