Download the PHP package ericsalerno/slzbot-irc without Composer

On this page you can find all versions of the php package ericsalerno/slzbot-irc. 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 slzbot-irc

slzbot-irc

For fun and practice, I'm throwing together a super simple PHP based irc bot that runs from the command line (or a container).

The idea would be to make an event based Bot class that you can extend to add your own business logic to.

I hope it should go without saying, but never run this bot as root!

Usage

Include the library in your project with composer.

composer require ericsalerno/slzbot-irc

You can use the bot by including salernolabs/slzbot-irc with composer and activating it like this.

$bot = new \SlzBot\IRC\Bot();

$bot
    ->setServer('irc.efnet.org', 6667)
    ->setChannels('#ircphp')
    ->setUser('myBotNickname', 'SlzBot')
       //any events and commands you want to bind can go here
    ->connect();

Events

You can bind and respond to events that occur from the server. You can bind multiple event executors to a single event. For example, 376 is the IRC op code for the end of the MOTD. You can bind an event to autojoin channels like this.

$autoJoins = new \SlzBot\IRC\Events\AutoJoin();
$autoJoins->setAutoJoins(['#programming', '#irc', '#php']);

$bot
   ->addOpCodeEvent(376, $autoJoins)

There are some op codes and other events that Slzbot listens for in the \SlzBot\IRC\OpCodes class.

The event class must implement the \SlzBot\IRC\Events\EventInterface interface to work so feel free to create them in your project.

Commands

You can also bind commands to your bot so that it can listen for user requests. For example if a user types !uptime and you want to listen for that keyword, you can do something like this:

$command = new \SlzBot\IRC\Commands\Uptime();

$bot
    ->addCommand('uptime', $command);

This would make the bot listen for users to say "!uptime" and then it would execute the code within the class. In this case it would just say how long it was since the class was instantiated.

The command class must implement the \SlzBot\IRC\Commands\CommandInterface interface to work so feel free to create them in your project. You can also change the activation character from the default of '!' with setCommandActivationCharacter.

Sample

You can run a quick sample with the included generic bot. From the command line and assuming you are in the project's directory:

/path/to/php samples/generic/bot.php nickname #channel irc.yourservername

The generic bot expects several parameters. Run it without parameters to get usage info.

Usage: php samples/generic/bot.php <nickname> <channel> <server> [port]

All versions of slzbot-irc with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
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 ericsalerno/slzbot-irc contains the following files

Loading the files please wait ...