Index
Classes
Every class, interface, exception, trait and enum, A to Z, with the topic it belongs to. Type to filter; methods appear when you filter.
20 symbols
C#
Cache– The cache every worker shares, from Swerve::cache(): a PSR-16 cache held by the master process, the least recently used entries evicted past --cache-size. Resource managementCacheKeyException– A key Swerve::cache can't take: PSR-16 keys are non-empty strings without {}()/@:. Resource managementClaim– A handle on a name that one holder at a time can hold across the whole server, from Swerve::claim. Coordination across workersClientRequest– One HTTP exchange with a client: the request to read, and the response to write. The application's RequestHandler is called once for each, and may keep it for as long as it likes (an event stream, a long download) by simply not returning. Request handlersCache::clear– Remove everything from the cache of every worker. Resource managementCache::delete– Remove $key from the cache of every worker. Resource managementCache::deleteMultiple– Remove several keys, as Cache::delete does. Resource managementCache::get– The value stored under $key, or $default when there is none or it has expired. Resource managementCache::getMultiple– The values of $keys, by key: $default for those missing or expired. Resource managementCache::has– Whether a value is stored under $key and has not expired. Resource managementCache::instance– The cache of this process: the one Swerve::cache returns. Resource managementCache::set– Store $value under $key for every worker, for $ttl seconds or until evicted. Resource managementCache::setMultiple– Store several values, by key, with one $ttl, as Cache::set does. Resource managementClaim::__construct– A handle on $name; Swerve::claim is how an application gets one. Coordination across workersClaim::__destruct– Releases: synchronous, so it cannot suspend. Coordination across workersClaim::acquire– Take the name, trying every 20 ms for up to $timeout seconds when another holds it. Coordination across workersClaim::available– Whether nobody holds the name now; nothing is claimed. Coordination across workersClaim::held– Whether this handle holds the name: it was acquired and not released. Coordination across workersClaim::release– Give the claim up, so that another can take it. Coordination across workersClientRequest::end– Finish the response. With no head sent, an implicit 200. Request handlersClientRequest::flush– Commit the head (an implicit 200) and put it on the wire, with nothing buffered. Request handlersClientRequest::getMethod– The request method, as sent: 'GET', 'POST', ... Request handlersClientRequest::getProtocolVersion– '1.0' or '1.1'. Request handlersClientRequest::getRequestHeaders– The request headers: lowercase name => the values, in order. host is among them. Request handlersClientRequest::getScheme– 'http' or 'https'; from a trusted proxy's X-Forwarded-Proto (see --trusted-proxy). Request handlersClientRequest::getTarget– The request target, as sent: '/path?query', '' or an absolute URI. Request handlersClientRequest::headersSent– Whether the final head is committed (it may still be held back until the first body bytes). Request handlersClientRequest::sendFile– Write a file, or part of one, as the body: commits the head, then streams it as write() does, under the same framing rules. No content-length is computed; send one with the head. Request handlersClientRequest::sendResponseHeaders– Set the response's status and headers. Request handlers
F#
FormBody– The form data of a request, parsed when first asked for: what PHP puts in $_POST and $_FILES. Request handlersFormBody::__destruct– Delete the uploaded files' temporary copies that were not moved with moveTo(). Request handlersFormBody::fields– $_POST: the fields. Request handlersFormBody::files– $_FILES, as PSR-7 UploadedFileInterface objects. Request handlersFormBody::for– The form of a request with this method and Content-Type, or null when PHP would not parse its body. Request handlersFormBody::input– php://input: an url-encoded body's bytes, still readable after parsing; a multipart one's are used up by the parser, as in PHP. Request handlers
H#
HeadersSentException– The final response head was already committed: its status and headers can't change. Request handlers
O#
OrderedChannel– A topic where every subscriber, in every worker, receives the messages in one and the same order, and each publisher's own messages keep theirs. Coordination across workersOrderedChannel::__construct– A channel by $name, separate from the plain topic of the same name. Coordination across workersOrderedChannel::getIterator– Subscribes with the defaults, so foreach ($channel as $message) subscribes at the foreach. Coordination across workersOrderedChannel::subscribe– Receive what is written from now on, as Swerve::subscribe does. Coordination across workersOrderedChannel::write– Append $message to the channel, where every subscriber receives it in the channel's one order. Coordination across workers
R#
RequestBody– A request's body as a PSR-7 stream, read from the ClientRequest as the application reads it. Request handlersRequestHandler– What an application's swerve.php returns: the callable that serves each HTTP exchange. Request handlersRequestBody::__construct– Wrap the body of $request; nothing is read until the application reads. Request handlersRequestBody::__toString– The rest of the body, read to its end: getContents(). Request handlersRequestBody::close– Closes the stream and any underlying resources. Request handlersRequestBody::detach– Separates any underlying resources from the stream. Request handlersRequestBody::eof– Returns true if the stream is at the end of the stream. Request handlersRequestBody::getContents– Returns the remaining contents in a string Request handlersRequestBody::getMetadata– Get stream metadata as an associative array or retrieve a specific key. Request handlersRequestBody::getSize– Get the size of the stream if known. Request handlersRequestBody::isReadable– Returns whether or not the stream is readable. Request handlersRequestBody::isSeekable– Returns whether or not the stream is seekable. Request handlersRequestBody::isWritable– Returns whether or not the stream is writable. Request handlersRequestBody::read– Read data from the stream. Request handlersRequestBody::rewind– Seek to the beginning of the stream. Request handlersRequestBody::seek– Seek to a position in the stream. Request handlersRequestBody::tell– Returns the current position of the file read/write pointer Request handlersRequestBody::write– Write data to the stream. Request handlersRequestHandler::__construct– Wrap the callable that serves each exchange. Request handlers
S#
SealedObject– A decoded JSON object that nobody can change: what a subscriber of Swerve::subscribe gets for a published object. Coordination across workersServerInterface– A protocol server, such as HTTP/1.1 (--http). Request handlersServerSentEvents– A Server-Sent Events stream (EventSource in the browser) on a ClientRequest. WebSockets and SSEStaticFiles– Serves the files of a directory, and passes every other request on to the application's handler. Request handlersStopReason– Why a worker stops, see WorkerStoppingException. ProductionSubscriberLagException– A subscription fell further behind its topic than its $maxLag seconds, see Subscription. Coordination across workersSubscription– The messages published to a topic, from Swerve::subscribe: iterate over it to receive them. Coordination across workersSwerve– What swerve gives the application: its log, the cache and the messages shared by every worker, and the state of the worker. Request handlersSealedObject::__construct– Wrap a decoded object; SealedObject::seal does it for a whole decoded value. Coordination across workersSealedObject::__get– The property $name; an object in it is a SealedObject. Coordination across workersSealedObject::__isset– Whether the property exists and is not null. Coordination across workersSealedObject::__set– Always throws: the message is shared by every subscriber. Coordination across workersSealedObject::__unset– Always throws: the message is shared by every subscriber. Coordination across workersSealedObject::getIterator– The properties by name; objects in them are SealedObjects. Coordination across workersSealedObject::jsonSerialize– A copy of the object as it was published, for json_encode(). Coordination across workersSealedObject::seal– What json_decode() (without assoc) returned, with its objects replaced by SealedObjects; the objects inside one are wrapped when first read. Coordination across workersServerInterface::drain– Stop accepting; ServerInterface::run returns once every connection has ended. Meanwhile the worker stops the requests in flight with a WorkerStoppingException at their wait, and the server ends its protocol for each (a 503 for a response not yet begun). Request handlersServerInterface::listen– Open the listener. Request handlersServerInterface::run– Accept and serve connections until drained. Request handlersServerSentEvents::__construct– Send the head of the stream. WebSockets and SSEServerSentEvents::comment– Send a comment: the browser ignores it, so it keeps the stream alive through proxies and lets a handler find out that the client is gone. WebSockets and SSEServerSentEvents::lastEventId– The Last-Event-ID the client sent when it reconnected: the id of the last event it saw before the connection dropped, or null at its first connection. WebSockets and SSEServerSentEvents::send– Send one event. WebSockets and SSEStaticFiles::__construct– Serve the files below $directory. Request handlersStaticFiles::wrap– A handler that answers the requests naming a file from the directory, and calls $app for every other. Request handlersSubscription::__construct– Subscribe to $topic: Swerve::subscribe is how an application gets one. Coordination across workersSubscription::__destruct– Ends the subscription: the topic stops keeping messages for it. Coordination across workersSubscription::getIterator– The messages, as they come; null after each $heartbeat seconds without one. Coordination across workersSwerve::awaitShutdown– Wait until this worker must close its connections, see Swerve::onShutdown. ProductionSwerve::cache– The cache every worker shares, held by the master process. Resource managementSwerve::claim– A handle on the name $name, which one holder at a time can hold across the workers. Coordination across workersSwerve::draining– Whether this worker drains: it is shutting down, reloading or being recycled. ProductionSwerve::getVersion– The installed version, as Composer knows it: 0.1.0, or dev-main in a checkout. ProductionSwerve::ini– php.ini settings a package needs in every swerve process. Call it from a file listed in your package's composer.json files: Composer loads it after swerve's own, as the master starts. swerve applies the settings with its startup restart, over its own settings; an explicit -d on the command line still wins. ProductionSwerve::log– The log of this process: swerve's own PSR-3 logger, in its format (the time, this worker's slot). ProductionSwerve::onShutdown– Run $callback when this worker must now close its connections: for an upgraded connection, to say goodbye in its protocol and end it. ProductionSwerve::onWorkerStart– Run $callback in every worker as it starts, before the application loads, inside the worker's event loop, so it may start coroutines that run for the worker's life. Register it the way Swerve::ini says; calls after startup change nothing. A callback that throws stops the worker, as an application that fails to load does. ProductionSwerve::publish– Send a message to every subscriber of $topic, in every worker process of this swerve, this one included. Coordination across workersSwerve::publishRaw– Send $bytes unchanged to every subscriber of $topic, in every worker process of this swerve, this one included. Coordination across workersSwerve::setLog– Replace the logger that Swerve::log returns. ProductionSwerve::subscribe– Receive what is published to $topic from now on. Coordination across workers
W#
WebSocket– A WebSocket connection (RFC 6455), server side, on a ClientRequest or any Duplex. WebSockets and SSEWebSocketHandshake– The decision of WebSocket::handshake: the answer to a WebSocket handshake. WebSockets and SSEWorkerStoppingException– Thrown into the coroutines still running when a worker stops, once its requests have finished (or its drain time is over): clean up at once, then let it end; the worker exits shortly after, whether or not they have. A phasync ShutdownException, so a CancelledException: code that only needs to stop catches nothing. $reason says why, for telling a client what happens next. ProductionWebSocket::accept– Answer the handshake and return the open connection, or null after refusing the request. WebSockets and SSEWebSocket::end– Close the connection: send a close frame with $code and $reason and end the sending side, once. WebSockets and SSEWebSocket::from– Answer the handshake and run $callback on the open connection; returns when the connection has closed. WebSockets and SSEWebSocket::getIterator– The messages received, until the connection closes: foreach ($ws as $message). WebSockets and SSEWebSocket::handshake– For framework adapters: decide a handshake from the parts of any request, answering nothing. WebSockets and SSEWebSocket::isBinary– Whether the message receive() returned last was binary, rather than text. WebSockets and SSEWebSocket::isClosed– Whether the connection is closed: end() was called, the client said goodbye, or the connection ended. WebSockets and SSEWebSocket::receive– The next text or binary message, or null once the connection is closed. WebSockets and SSEWebSocket::run– For adapters whose own code already sent the 101 (such as swerve-psr15's bridge, after its middleware decided the headers): run $callback on $connection as WebSocket::upgrade does, with the same close codes and cancellation. $connection need be no more than a Duplex: read(), write(), end() and close() are all this uses. WebSockets and SSEWebSocket::send– Send a text message; nothing happens once the connection is closed. WebSockets and SSEWebSocket::sendBinary– Send a binary message; nothing happens once the connection is closed. WebSockets and SSEWebSocket::upgrade– For framework adapters: send the 101 with the headers an adapter decided, and run $callback on the open connection. WebSockets and SSEWebSocketHandshake::__construct– The decision as WebSocket::handshake makes it. WebSockets and SSEWebSocketHandshake::accepted– Whether the connection may be upgraded: the status is 101. WebSockets and SSEWorkerStoppingException::__construct– An exception for a worker that stops for $reason; its message names the reason. Production