PHP code example of wildphp / irc-messages

1. Go to this page and download the library: Download wildphp/irc-messages 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/ */

    

wildphp / irc-messages example snippets


// Privmsg(string $channel, string $message)
$privmsg = new Privmsg('#channel', 'This is a message');

$rawMessage = (string) $privmsg; //: "PRIVMSG #channel :This is a message" + "\r\n" 

// IncomingMessage(string $prefix, string $verb, array $args)
$incoming = new IncomingMessage('nickname!username@hostname', 'PRIVMSG', ['This is a message']);

$privmsg = Privmsg::fromIncomingMessage($incoming);

$incoming = new IncomingMessage('nickname!username@hostname', 'PRIVMSG', ['This is a message']);

$privmsg = MessageCaster::castMessage($incoming);

// $privmsg is now an object of the Privmsg class.

$topicClass = RplTranslateEnum::translateNumeric('332');

// $topicClass is now '\WildPHP\Messages\RPL\Topic'