Download the PHP package omnicolor/php-irc-client without Composer

On this page you can find all versions of the php package omnicolor/php-irc-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-irc-client

PHP IRC Client

A pure PHP IRC client based on ReactPHP.

Documentation


Client

The client is the heart of the library, this object is used to perform all communication between your application and the IRC server. It will manage the connection to the IRC server and has all functions needed to interact with the server.

use Jerodev\PhpIrcClient\IrcClient;

$client = new IrcClient('irc.server:6667', 'Jerodev');
$client->connect();

Connecting to the server

$client->connect()

This function opens the connection to the IRC server. Username has to be set before the connection can be opened.

Sending commands to the server

$client->send(string $command)

Sends a raw IRC command directly to the server. This method should only be used if you really know what you are doing, it is recommended to use the built-in functions below.

Name Type Description
$command string The raw irc command

Joining a channel

$client->join(string $channel)

Joins a specified channel

Name Type Description
$channel string The name of the channel to join.

Leaving a channel

$client->part(string $channel)

Leave a channel. If the specified channel has not yet been joined, nothing will happen.

Name Type Description
$channel string The name of the channel to part.

Sending messages

$client->say(string $target, string $message)

Sends a message to a channel or user.

Name Type Description
$target string A name of a channel staring with # or the nickname of the user to send a message to.
$message string The message to send to the target.

Events

The on() function on the client can be used to register to several different events. This can be done both before and after connecting to the IRC server. Events have variable callback arguments, all are described below.

Registered on server

$client->on('registered', function () { });

Emitted when the server sends the initial welcome message (001). This indicates that you are connected to the server.

Message of the day

$client->on('motd', function (string $motd) { });

Emitted when the server sends the message of the day to the client. If the message of the day is multiple lines, this event might be emitted multiple times.

Name Type Description
$motd string The server's Message Of The Day.

Topic changed

$client->on('topic', function (string $channel, string $topic) { });

Emitted when joining a channel or when the topic of a joined channel changes.

Name Type Description
$channel string The channel where the topic has changed.
$topic string The new topic for this channel.

Channel users received

$client->on('names', function (string $channel, string[] $nicks) { });

Emitted when the server sends a list of nicks for a channel. This happens immediately after joining a channel and on request.

Name Type Description
$channel string The channel name.
$names string[] A list of nicknames who are currently in this channel.

You can also specify the channel you want to listen on by adding #channel to the event.
For example: $client->on('names#channel', function ($names) {})

Message received

$client->on('message', function (string $from, IrcChannel $channel, string $message) { });

Emitted when a message is sent to a connected channel.

Name Type Description
$from string The nickname of the user who sent the message.
$channel IrcChannel The channel where the message was sent.
$message string The received message.

You can also specify the channel you want to listen on by adding #channel to the event.
For example: $client->on('message#channel', function ($from, $channel, $message) {})

Ping received

$client->on('ping', function () { });

Emitted when the server sends a ping request to the client. The pong request has already been sent back to the server before this event is emitted.


All versions of php-irc-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
react/socket Version ^1.12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package omnicolor/php-irc-client contains the following files

Loading the files please wait ....