Download the PHP package epochblue/philip without Composer

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

Philip - a PHP IRC bot framework

Build Status

Philip is a Slim-inspired framwork for creating simple IRC bots. It was written by Bill Israel. The purpose of the project is to allow people to create fun, simple IRC bots with minimal overhead or complexity.

Requirements

Installation

The best way to create a bot based on Philip is to use Composer. From the command line, create a directory for your bot. In this directory, first download Composer:

Then create and open a composer.json file. Add Philip to the list of required libraries:

Run Composer's install command to download and install the Philip library:

Once this is complete, your directory should have a few new items (a composer.lock file, and a vendors directory) in it, and you should be ready to go. All that's left is to create the the bot. You can name your bot whatever you want, though bot.php is nice and easy. Here's a basic example:

Save your file, and start your bot:

And that's all there is to it! Your bot will connect to the IRC server and join the channels you've specified. Then it'll start listening for any commands you've created. For more information about Philip's API, please see the API section below. But first, let's quickly cover the configuration array...

Configuration

Configuration for Philip is a basic array of key-value pairs. Here's a quick reference to what each key value pair is:

API

Philip's API is simple and similar to JavaScript's "on*" event system. You add functionality to your bot by telling it how to respond to certain events. Events include things like channel messages, private messages, users joining a channel, users leaving a channel, etc.

There are two kinds of events in Philip: server events and message events. The only real difference between the two is that you can tell Philip to conditionally respond to message events. Since your bot will always respond to server events, the API for those is simpler:

Possible values for <Event> in this case are: Join, Part, Error, and Notice.

For message events, to determine whether your bot should respond to a given event, you will supply a regular expression that Philip will test against. If the regex matches, then Philip will execute the callback function you provide. The API for message events is:

Possible values for <Event> include Channel, PrivateMessage, and Message.

Event Examples:

The <regex pattern> is a standard PHP regular expression. If null is passed instead of a regular expression, the callback function will always be executed for that event type. If any match groups are specified in the regular expression, they will be passed to the callback function through the event.

If your regular expression is successfully matched, Philip will execute the callback function you provide, allowing you to respond to the message. The <callback function> is an anonymous function that accepts one parameter: $event.

Setting the <priority> is optional. In case a event matches multiple callback functions, the one with the highest priority is executed first. If priority is not set, the default value (0) will be used. If multiple callbacks have the same priority, they are executed in the order they where added.

$event is an instance of Philip\IRC\Event (which is a simple wrapper over an IRC "event"). The main functions in the public API for a Philip Event re:

There is no captured return value for the callback function. However, if you wish to send a message back to the IRC server, your callback function can add a response to the list of responses by using the addResponse() method on the Event object. The addResponse() method expects its only parameter to be an instance of a Philip Response object.

Putting all this together, let's look an example of adding echo functionality to Philip:

Example:

In this example, the bot will listen for channel messages that begin with !echo and are followed by anything else. The "anything else" is captured in a match group and passed to the callback function. The callback function simply adds a response to the event that send the matching message back to the channel that originally received the message.

Methods of note in the Philip\IRC\Request object:

Methods of note in the Philip\IRC\Response object:

Plugins

Philip supports a basic plugin system, and adding a plugin to your bot is simple.

Using a plugin

Using a plugin is simple. Plugins should be Composer-able, so start by include the plugins via Composer. Once you've run composer update and your plugins are available in your bot, you can load the plugins by calling either loadPlugin(<name>) (to load them one at a time), or loadPlugins(array()) (to load multiple plugins at once).

For example, if you had a plugin whose full, namespaced classname was \Example\Philip\Plugin\HelloPlugin, you can do load it in your both with either of the following:

Plugins accept a second (optional) parameter on their constructor if the plugin requires some configuration. Loading a plugin that accepts configuration might look like this:

Additionally, if you'd like to turn some of your bot's functionality into a plugin, that's easy as well.

Writing a plugin

Creating a plugin is simple. A plugin must extend the Philip\AbstractPlugin class and must provide and implementation for an init() and a getName() method. And that's it. Your plugin can be named anything, however, by convention most Philip plugins are named like <xxx>Plugin Below is an example of a simple plugin:

License

Copyright (c) 2012 Bill Israel [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This license is also included in the LICENSE file.

Author

Bill Israel - https://github.com/epochblue - https://twitter.com/epochblue

Contributors

Doug Hurst - https://github.com/dalanhurst - https://twitter.com/dalanhurst
Micah Breedlove - https://github.com/druid628 - https://twitter.com/druid628
Julien Bianchi - https://github.com/jubianchi - https://twitter.com/jubianchi

Acknowledgements

Philip was heavily inspired by the Slim framework and Isaac IRC DSL projects.


All versions of philip with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
monolog/monolog Version 1.7.*
symfony/event-dispatcher Version 2.1.*
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 epochblue/philip contains the following files

Loading the files please wait ....