<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.remote.other.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'book.event.php',
    1 => 'Event',
    2 => 'Event',
  ),
  'up' => 
  array (
    0 => 'refs.remote.other.php',
    1 => 'Other Services',
  ),
  'prev' => 
  array (
    0 => 'curlstringfile.construct.php',
    1 => 'CURLStringFile::__construct',
  ),
  'next' => 
  array (
    0 => 'event.setup.php',
    1 => 'Installing/Configuring',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/event/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.event.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.event" class="book">
 
 <h1 class="title">Event</h1>
 
 <div id="intro.event" class="preface">
  <h1 class="title">Introduction</h1>
  <p class="para">
   This is an extension to efficiently schedule I/O, time and signal based
   events using the best I/O notification mechanism available for specific
   platform. This is a port of libevent to the PHP infrastructure.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Note, Windows support introduced in
    <code class="literal">event-1.9.0</code>.
   </p>
  </p></blockquote>
  <p class="para">
   Version
   <em>1.0.0</em>
   introduces new object-oriented API (breaking backwards compatibility), and
   support of libevent 2+ including HTTP, DNS, OpenSSL and the event listener.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Note,
    <code class="literal">event-1.0.0</code>
    and greater is not compatible with previous versions.
   </p>
  </p></blockquote>
 </div>
 




 




 




 




 




 




 




 




 




 




 




 




 




 




 




 




 




 




 




 





<ul class="chunklist chunklist_book"><li><a href="event.setup.php">Installing/Configuring</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="event.requirements.php">Requirements</a></li><li><a href="event.installation.php">Installation</a></li></ul></li><li><a href="event.examples.php">Examples</a></li><li><a href="event.flags.php">Event flags</a></li><li><a href="event.persistence.php">About event persistence</a></li><li><a href="event.callbacks.php">Event callbacks</a></li><li><a href="event.constructing.signal.events.php">Constructing signal events</a></li><li><a href="class.event.php">Event</a> — The Event class<ul class="chunklist chunklist_book chunklist_children"><li><a href="event.add.php">Event::add</a> — Makes event pending</li><li><a href="event.addsignal.php">Event::addSignal</a> — Alias of Event::add</li><li><a href="event.addtimer.php">Event::addTimer</a> — Alias of Event::add</li><li><a href="event.construct.php">Event::__construct</a> — Constructs Event object</li><li><a href="event.del.php">Event::del</a> — Makes event non-pending</li><li><a href="event.delsignal.php">Event::delSignal</a> — Alias of Event::del</li><li><a href="event.deltimer.php">Event::delTimer</a> — Alias of Event::del</li><li><a href="event.free.php">Event::free</a> — Make event non-pending and free resources allocated for this
  event</li><li><a href="event.getsupportedmethods.php">Event::getSupportedMethods</a> — Returns array with of the names of the methods supported in this version of Libevent</li><li><a href="event.pending.php">Event::pending</a> — Detects whether event is pending or scheduled</li><li><a href="event.set.php">Event::set</a> — Re-configures event</li><li><a href="event.setpriority.php">Event::setPriority</a> — Set event priority</li><li><a href="event.settimer.php">Event::setTimer</a> — Re-configures timer event</li><li><a href="event.signal.php">Event::signal</a> — Constructs signal event object</li><li><a href="event.timer.php">Event::timer</a> — Constructs timer event object</li></ul></li><li><a href="class.eventbase.php">EventBase</a> — The EventBase class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventbase.construct.php">EventBase::__construct</a> — Constructs EventBase object</li><li><a href="eventbase.dispatch.php">EventBase::dispatch</a> — Dispatch pending events</li><li><a href="eventbase.exit.php">EventBase::exit</a> — Stop dispatching events</li><li><a href="eventbase.free.php">EventBase::free</a> — Free resources allocated for this event base</li><li><a href="eventbase.getfeatures.php">EventBase::getFeatures</a> — Returns bitmask of features supported</li><li><a href="eventbase.getmethod.php">EventBase::getMethod</a> — Returns event method in use</li><li><a href="eventbase.gettimeofdaycached.php">EventBase::getTimeOfDayCached</a> — Returns the current event base time</li><li><a href="eventbase.gotexit.php">EventBase::gotExit</a> — Checks if the event loop was told to exit</li><li><a href="eventbase.gotstop.php">EventBase::gotStop</a> — Checks if the event loop was told to exit</li><li><a href="eventbase.loop.php">EventBase::loop</a> — Dispatch pending events</li><li><a href="eventbase.priorityinit.php">EventBase::priorityInit</a> — Sets number of priorities per event base</li><li><a href="eventbase.reinit.php">EventBase::reInit</a> — Re-initialize event base(after a fork)</li><li><a href="eventbase.stop.php">EventBase::stop</a> — Tells event_base to stop dispatching events</li></ul></li><li><a href="class.eventbuffer.php">EventBuffer</a> — The EventBuffer class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventbuffer.add.php">EventBuffer::add</a> — Append data to the end of an event buffer</li><li><a href="eventbuffer.addbuffer.php">EventBuffer::addBuffer</a> — Move all data from a buffer provided to the current instance of EventBuffer</li><li><a href="eventbuffer.appendfrom.php">EventBuffer::appendFrom</a> — Moves the specified number of bytes from a source buffer to the
  end of the current buffer</li><li><a href="eventbuffer.construct.php">EventBuffer::__construct</a> — Constructs EventBuffer object</li><li><a href="eventbuffer.copyout.php">EventBuffer::copyout</a> — Copies out specified number of bytes from the front of the buffer</li><li><a href="eventbuffer.drain.php">EventBuffer::drain</a> — Removes specified number of bytes from the front of the buffer
  without copying it anywhere</li><li><a href="eventbuffer.enablelocking.php">EventBuffer::enableLocking</a> — Description</li><li><a href="eventbuffer.expand.php">EventBuffer::expand</a> — Reserves space in buffer</li><li><a href="eventbuffer.freeze.php">EventBuffer::freeze</a> — Prevent calls that modify an event buffer from succeeding</li><li><a href="eventbuffer.lock.php">EventBuffer::lock</a> — Acquires a lock on buffer</li><li><a href="eventbuffer.prepend.php">EventBuffer::prepend</a> — Prepend data to the front of the buffer</li><li><a href="eventbuffer.prependbuffer.php">EventBuffer::prependBuffer</a> — Moves all data from source buffer to the front of current buffer</li><li><a href="eventbuffer.pullup.php">EventBuffer::pullup</a> — Linearizes data within buffer
  and returns it's contents as a string</li><li><a href="eventbuffer.read.php">EventBuffer::read</a> — Read data from an evbuffer and drain the bytes read</li><li><a href="eventbuffer.readfrom.php">EventBuffer::readFrom</a> — Read data from a file onto the end of the buffer</li><li><a href="eventbuffer.readline.php">EventBuffer::readLine</a> — Extracts a line from the front of the buffer</li><li><a href="eventbuffer.search.php">EventBuffer::search</a> — Scans the buffer for an occurrence of a string</li><li><a href="eventbuffer.searcheol.php">EventBuffer::searchEol</a> — Scans the buffer for an occurrence of an end of line</li><li><a href="eventbuffer.substr.php">EventBuffer::substr</a> — Substracts a portion of the buffer data</li><li><a href="eventbuffer.unfreeze.php">EventBuffer::unfreeze</a> — Re-enable calls that modify an event buffer</li><li><a href="eventbuffer.unlock.php">EventBuffer::unlock</a> — Releases lock acquired by EventBuffer::lock</li><li><a href="eventbuffer.write.php">EventBuffer::write</a> — Write contents of the buffer to a file or socket</li></ul></li><li><a href="class.eventbufferevent.php">EventBufferEvent</a> — The EventBufferEvent class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventbufferevent.close.php">EventBufferEvent::close</a> — Closes file descriptor associated with the current buffer event</li><li><a href="eventbufferevent.connect.php">EventBufferEvent::connect</a> — Connect buffer event's file descriptor to given address or
  UNIX socket</li><li><a href="eventbufferevent.connecthost.php">EventBufferEvent::connectHost</a> — Connects to a hostname with optionally asyncronous DNS resolving</li><li><a href="eventbufferevent.construct.php">EventBufferEvent::__construct</a> — Constructs EventBufferEvent object</li><li><a href="eventbufferevent.createpair.php">EventBufferEvent::createPair</a> — Creates two buffer events connected to each other</li><li><a href="eventbufferevent.disable.php">EventBufferEvent::disable</a> — Disable events read, write, or both on a buffer event</li><li><a href="eventbufferevent.enable.php">EventBufferEvent::enable</a> — Enable events read, write, or both on a buffer event</li><li><a href="eventbufferevent.free.php">EventBufferEvent::free</a> — Free a buffer event</li><li><a href="eventbufferevent.getdnserrorstring.php">EventBufferEvent::getDnsErrorString</a> — Returns string describing the last failed DNS lookup attempt</li><li><a href="eventbufferevent.getenabled.php">EventBufferEvent::getEnabled</a> — Returns bitmask of events currently enabled on the buffer event</li><li><a href="eventbufferevent.getinput.php">EventBufferEvent::getInput</a> — Returns underlying input buffer associated with current buffer
  event</li><li><a href="eventbufferevent.getoutput.php">EventBufferEvent::getOutput</a> — Returns underlying output buffer associated with current buffer
  event</li><li><a href="eventbufferevent.read.php">EventBufferEvent::read</a> — Read buffer's data</li><li><a href="eventbufferevent.readbuffer.php">EventBufferEvent::readBuffer</a> — Drains the entire contents of the input buffer and places them into buf</li><li><a href="eventbufferevent.setcallbacks.php">EventBufferEvent::setCallbacks</a> — Assigns read, write and event(status) callbacks</li><li><a href="eventbufferevent.setpriority.php">EventBufferEvent::setPriority</a> — Assign a priority to a bufferevent</li><li><a href="eventbufferevent.settimeouts.php">EventBufferEvent::setTimeouts</a> — Set the read and write timeout for a buffer event</li><li><a href="eventbufferevent.setwatermark.php">EventBufferEvent::setWatermark</a> — Adjusts read and/or write watermarks</li><li><a href="eventbufferevent.sslerror.php">EventBufferEvent::sslError</a> — Returns most recent OpenSSL error reported on the buffer event</li><li><a href="eventbufferevent.sslfilter.php">EventBufferEvent::sslFilter</a> — Create a new SSL buffer event to send its data over another buffer event</li><li><a href="eventbufferevent.sslgetcipherinfo.php">EventBufferEvent::sslGetCipherInfo</a> — Returns a textual description of the cipher</li><li><a href="eventbufferevent.sslgetciphername.php">EventBufferEvent::sslGetCipherName</a> — Returns the current cipher name of the SSL connection</li><li><a href="eventbufferevent.sslgetcipherversion.php">EventBufferEvent::sslGetCipherVersion</a> — Returns version of cipher used by current SSL connection</li><li><a href="eventbufferevent.sslgetprotocol.php">EventBufferEvent::sslGetProtocol</a> — Returns the name of the protocol used for current SSL connection</li><li><a href="eventbufferevent.sslrenegotiate.php">EventBufferEvent::sslRenegotiate</a> — Tells a bufferevent to begin SSL renegotiation</li><li><a href="eventbufferevent.sslsocket.php">EventBufferEvent::sslSocket</a> — Creates a new SSL buffer event to send its data over an SSL on a socket</li><li><a href="eventbufferevent.write.php">EventBufferEvent::write</a> — Adds data to a buffer event's output buffer</li><li><a href="eventbufferevent.writebuffer.php">EventBufferEvent::writeBuffer</a> — Adds contents of the entire buffer to a buffer event's output
  buffer</li></ul></li><li><a href="eventbufferevent.about.callbacks.php">About buffer event callbacks</a></li><li><a href="class.eventconfig.php">EventConfig</a> — The EventConfig class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventconfig.avoidmethod.php">EventConfig::avoidMethod</a> — Tells libevent to avoid specific event method</li><li><a href="eventconfig.construct.php">EventConfig::__construct</a> — Constructs EventConfig object</li><li><a href="eventconfig.requirefeatures.php">EventConfig::requireFeatures</a> — Enters a required event method feature that the application demands</li><li><a href="eventconfig.setflags.php">EventConfig::setFlags</a> — Sets one or more flags to configure the eventual EventBase will be initialized</li><li><a href="eventconfig.setmaxdispatchinterval.php">EventConfig::setMaxDispatchInterval</a> — Prevents priority inversion</li></ul></li><li><a href="class.eventdnsbase.php">EventDnsBase</a> — The EventDnsBase class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventdnsbase.addnameserverip.php">EventDnsBase::addNameserverIp</a> — Adds a nameserver to the DNS base</li><li><a href="eventdnsbase.addsearch.php">EventDnsBase::addSearch</a> — Adds a domain to the list of search domains</li><li><a href="eventdnsbase.clearsearch.php">EventDnsBase::clearSearch</a> — Removes all current search suffixes</li><li><a href="eventdnsbase.construct.php">EventDnsBase::__construct</a> — Constructs EventDnsBase object</li><li><a href="eventdnsbase.countnameservers.php">EventDnsBase::countNameservers</a> — Gets the number of configured nameservers</li><li><a href="eventdnsbase.loadhosts.php">EventDnsBase::loadHosts</a> — Loads a hosts file (in the same format as /etc/hosts) from hosts file</li><li><a href="eventdnsbase.parseresolvconf.php">EventDnsBase::parseResolvConf</a> — Scans the resolv.conf-formatted file</li><li><a href="eventdnsbase.setoption.php">EventDnsBase::setOption</a> — Set the value of a configuration option</li><li><a href="eventdnsbase.setsearchndots.php">EventDnsBase::setSearchNdots</a> — Set the 'ndots' parameter for searches</li></ul></li><li><a href="class.eventhttp.php">EventHttp</a> — The EventHttp class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventhttp.accept.php">EventHttp::accept</a> — Makes an HTTP server accept connections on the specified socket stream or resource</li><li><a href="eventhttp.addserveralias.php">EventHttp::addServerAlias</a> — Adds a server alias to the HTTP server object</li><li><a href="eventhttp.bind.php">EventHttp::bind</a> — Binds an HTTP server on the specified address and port</li><li><a href="eventhttp.construct.php">EventHttp::__construct</a> — Constructs EventHttp object (the HTTP server)</li><li><a href="eventhttp.removeserveralias.php">EventHttp::removeServerAlias</a> — Removes server alias</li><li><a href="eventhttp.setallowedmethods.php">EventHttp::setAllowedMethods</a> — Sets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks</li><li><a href="eventhttp.setcallback.php">EventHttp::setCallback</a> — Sets a callback for specified URI</li><li><a href="eventhttp.setdefaultcallback.php">EventHttp::setDefaultCallback</a> — Sets default callback to handle requests that are not caught by specific callbacks</li><li><a href="eventhttp.setmaxbodysize.php">EventHttp::setMaxBodySize</a> — Sets maximum request body size</li><li><a href="eventhttp.setmaxheaderssize.php">EventHttp::setMaxHeadersSize</a> — Sets maximum HTTP header size</li><li><a href="eventhttp.settimeout.php">EventHttp::setTimeout</a> — Sets the timeout for an HTTP request</li></ul></li><li><a href="class.eventhttpconnection.php">EventHttpConnection</a> — The EventHttpConnection class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventhttpconnection.construct.php">EventHttpConnection::__construct</a> — Constructs EventHttpConnection object</li><li><a href="eventhttpconnection.getbase.php">EventHttpConnection::getBase</a> — Returns event base associated with the connection</li><li><a href="eventhttpconnection.getpeer.php">EventHttpConnection::getPeer</a> — Gets the remote address and port associated with the connection</li><li><a href="eventhttpconnection.makerequest.php">EventHttpConnection::makeRequest</a> — Makes an HTTP request over the specified connection</li><li><a href="eventhttpconnection.setclosecallback.php">EventHttpConnection::setCloseCallback</a> — Set callback for connection close</li><li><a href="eventhttpconnection.setlocaladdress.php">EventHttpConnection::setLocalAddress</a> — Sets the IP address from which HTTP connections are made</li><li><a href="eventhttpconnection.setlocalport.php">EventHttpConnection::setLocalPort</a> — Sets the local port from which connections are made</li><li><a href="eventhttpconnection.setmaxbodysize.php">EventHttpConnection::setMaxBodySize</a> — Sets maximum body size for the connection</li><li><a href="eventhttpconnection.setmaxheaderssize.php">EventHttpConnection::setMaxHeadersSize</a> — Sets maximum header size</li><li><a href="eventhttpconnection.setretries.php">EventHttpConnection::setRetries</a> — Sets the retry limit for the connection</li><li><a href="eventhttpconnection.settimeout.php">EventHttpConnection::setTimeout</a> — Sets the timeout for the connection</li></ul></li><li><a href="class.eventhttprequest.php">EventHttpRequest</a> — The EventHttpRequest class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventhttprequest.addheader.php">EventHttpRequest::addHeader</a> — Adds an HTTP header to the headers of the request</li><li><a href="eventhttprequest.cancel.php">EventHttpRequest::cancel</a> — Cancels a pending HTTP request</li><li><a href="eventhttprequest.clearheaders.php">EventHttpRequest::clearHeaders</a> — Removes all output headers from the header list of the request</li><li><a href="eventhttprequest.closeconnection.php">EventHttpRequest::closeConnection</a> — Closes associated HTTP connection</li><li><a href="eventhttprequest.construct.php">EventHttpRequest::__construct</a> — Constructs EventHttpRequest object</li><li><a href="eventhttprequest.findheader.php">EventHttpRequest::findHeader</a> — Finds the value belonging a header</li><li><a href="eventhttprequest.free.php">EventHttpRequest::free</a> — Frees the object and removes associated events</li><li><a href="eventhttprequest.getbufferevent.php">EventHttpRequest::getBufferEvent</a> — Returns EventBufferEvent object</li><li><a href="eventhttprequest.getcommand.php">EventHttpRequest::getCommand</a> — Returns the request command(method)</li><li><a href="eventhttprequest.getconnection.php">EventHttpRequest::getConnection</a> — Returns EventHttpConnection object</li><li><a href="eventhttprequest.gethost.php">EventHttpRequest::getHost</a> — Returns the request host</li><li><a href="eventhttprequest.getinputbuffer.php">EventHttpRequest::getInputBuffer</a> — Returns the input buffer</li><li><a href="eventhttprequest.getinputheaders.php">EventHttpRequest::getInputHeaders</a> — Returns associative array of the input headers</li><li><a href="eventhttprequest.getoutputbuffer.php">EventHttpRequest::getOutputBuffer</a> — Returns the output buffer of the request</li><li><a href="eventhttprequest.getoutputheaders.php">EventHttpRequest::getOutputHeaders</a> — Returns associative array of the output headers</li><li><a href="eventhttprequest.getresponsecode.php">EventHttpRequest::getResponseCode</a> — Returns the response code</li><li><a href="eventhttprequest.geturi.php">EventHttpRequest::getUri</a> — Returns the request URI</li><li><a href="eventhttprequest.removeheader.php">EventHttpRequest::removeHeader</a> — Removes an HTTP header from the headers of the request</li><li><a href="eventhttprequest.senderror.php">EventHttpRequest::sendError</a> — Send an HTML error message to the client</li><li><a href="eventhttprequest.sendreply.php">EventHttpRequest::sendReply</a> — Send an HTML reply to the client</li><li><a href="eventhttprequest.sendreplychunk.php">EventHttpRequest::sendReplyChunk</a> — Send another data chunk as part of an ongoing chunked reply</li><li><a href="eventhttprequest.sendreplyend.php">EventHttpRequest::sendReplyEnd</a> — Complete a chunked reply, freeing the request as appropriate</li><li><a href="eventhttprequest.sendreplystart.php">EventHttpRequest::sendReplyStart</a> — Initiate a chunked reply</li></ul></li><li><a href="class.eventlistener.php">EventListener</a> — The EventListener class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventlistener.construct.php">EventListener::__construct</a> — Creates new connection listener associated with an event base</li><li><a href="eventlistener.disable.php">EventListener::disable</a> — Disables an event connect listener object</li><li><a href="eventlistener.enable.php">EventListener::enable</a> — Enables an event connect listener object</li><li><a href="eventlistener.getbase.php">EventListener::getBase</a> — Returns event base associated with the event listener</li><li><a href="eventlistener.getsocketname.php">EventListener::getSocketName</a> — Retreives the current address to which the
  listener's socket is bound</li><li><a href="eventlistener.setcallback.php">EventListener::setCallback</a> — The setCallback purpose</li><li><a href="eventlistener.seterrorcallback.php">EventListener::setErrorCallback</a> — Set event listener's error callback</li></ul></li><li><a href="class.eventsslcontext.php">EventSslContext</a> — The EventSslContext class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventsslcontext.construct.php">EventSslContext::__construct</a> — Constructs an OpenSSL context for use with Event classes</li></ul></li><li><a href="class.eventutil.php">EventUtil</a> — The EventUtil class<ul class="chunklist chunklist_book chunklist_children"><li><a href="eventutil.construct.php">EventUtil::__construct</a> — The abstract constructor</li><li><a href="eventutil.getlastsocketerrno.php">EventUtil::getLastSocketErrno</a> — Returns the most recent socket error number</li><li><a href="eventutil.getlastsocketerror.php">EventUtil::getLastSocketError</a> — Returns the most recent socket error</li><li><a href="eventutil.getsocketfd.php">EventUtil::getSocketFd</a> — Returns numeric file descriptor of a socket, or stream</li><li><a href="eventutil.getsocketname.php">EventUtil::getSocketName</a> — Retreives the current address to which the
  socket is bound</li><li><a href="eventutil.setsocketoption.php">EventUtil::setSocketOption</a> — Sets socket options</li><li><a href="eventutil.sslrandpoll.php">EventUtil::sslRandPoll</a> — Generates entropy by means of OpenSSL's RAND_poll()</li></ul></li><li><a href="class.eventexception.php">EventException</a> — The EventException class</li></ul></div><?php manual_footer($setup); ?>