Better PHP Documentation
opinionated
Open main menu
Get Started
Documentation
Community
Training
Better PHP Documentation
Close menu
Get Started
Documentation
Community
Training
Log in
Change language:
English
German
Spanish
French
Italian
Japanese
Brazilian Portuguese
Russian
Turkish
Ukrainian
Chinese (Simplified)
Other
Swoole
Introduction
Installing/Configuring
Requirements
Installation
Runtime Configuration
Predefined Constants
Swoole Functions
swoole_async_dns_lookup
β Async and non-blocking hostname to IP lookup
swoole_async_read
β Read file stream asynchronously
swoole_async_readfile
β Read a file asynchronously
swoole_async_set
β Update the async I/O options
swoole_async_write
β Write data to a file stream asynchronously
swoole_async_writefile
β Write data to a file asynchronously
swoole_clear_error
β Clear errors in the socket or on the last error code
swoole_client_select
β Get the file description which are ready to read/write or error
swoole_cpu_num
β Get the number of CPU
swoole_errno
β Get the error code of the latest system call
swoole_error_log
β Output error messages to the log
swoole_event_add
β Add new callback functions of a socket into the EventLoop
swoole_event_defer
β Add callback function to the next event loop
swoole_event_del
β Remove all event callback functions of a socket
swoole_event_exit
β Exit the eventloop, only available at the client side
swoole_event_set
β Update the event callback functions of a socket
swoole_event_wait
β Start the event loop
swoole_event_write
β Write data to a socket
swoole_get_local_ip
β Get the IPv4 IP addresses of each NIC on the machine
swoole_last_error
β Get the lastest error message
swoole_load_module
β Load a swoole extension
swoole_select
β Select the file descriptions which are ready to read/write or error in the eventloop
swoole_set_process_name
β Set the process name
swoole_strerror
β Convert the Errno into error messages
swoole_timer_after
β Trigger a one time callback function in the future
swoole_timer_exists
β Check if a timer callback function is existed
swoole_timer_tick
β Trigger a timer tick callback function by time interval
swoole_version
β Get the version of Swoole
Swoole\Async
β The Swoole\Async class
Swoole\Async::dnsLookup
β Async and non-blocking hostname to IP lookup.
Swoole\Async::read
β Read file stream asynchronously.
Swoole\Async::readFile
β Read a file asynchronously.
Swoole\Async::set
β Update the async I/O options.
Swoole\Async::write
β Write data to a file stream asynchronously.
Swoole\Async::writeFile
β Description
Swoole\Atomic
β The Swoole\Atomic class
Swoole\Atomic::add
β Add a number to the value to the atomic object.
Swoole\Atomic::cmpset
β Compare and set the value of the atomic object.
Swoole\Atomic::__construct
β Construct a swoole atomic object.
Swoole\Atomic::get
β Get the current value of the atomic object.
Swoole\Atomic::set
β Set a new value to the atomic object.
Swoole\Atomic::sub
β Subtract a number to the value of the atomic object.
Swoole\Buffer
β The Swoole\Buffer class
Swoole\Buffer::append
β Append the string or binary data at the end of the memory buffer and return the new size of memory allocated.
Swoole\Buffer::clear
β Reset the memory buffer.
Swoole\Buffer::__construct
β Fixed size memory blocks allocation.
Swoole\Buffer::__destruct
β Destruct the Swoole memory buffer.
Swoole\Buffer::expand
β Expand the size of memory buffer.
Swoole\Buffer::read
β Read data from the memory buffer based on offset and length.
Swoole\Buffer::recycle
β Release the memory to OS which is not used by the memory buffer.
Swoole\Buffer::substr
β Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.
Swoole\Buffer::__toString
β Get the string value of the memory buffer.
Swoole\Buffer::write
β Write data to the memory buffer. The memory allocated for the buffer will not be changed.
Swoole\Channel
β The Swoole\Channel class
Swoole\Channel::__construct
β Construct a Swoole Channel
Swoole\Channel::__destruct
β Destruct a Swoole channel.
Swoole\Channel::pop
β Read and pop data from swoole channel.
Swoole\Channel::push
β Write and push data into Swoole channel.
Swoole\Channel::stats
β Get stats of swoole channel.
Swoole\Client
β The Swoole\Client class
Swoole\Client::close
β Close the connection established.
Swoole\Client::connect
β Connect to the remote TCP or UDP port.
Swoole\Client::__construct
β Create Swoole sync or async TCP/UDP client, with or without SSL.
Swoole\Client::__destruct
β Destruct the Swoole client.
Swoole\Client::getpeername
β Get the remote socket name of the connection.
Swoole\Client::getsockname
β Get the local socket name of the connection.
Swoole\Client::isConnected
β Check if the connection is established.
Swoole\Client::on
β Add callback functions triggered by events.
Swoole\Client::pause
β Pause receiving data.
Swoole\Client::pipe
β Redirect the data to another file descriptor.
Swoole\Client::recv
β Receive data from the remote socket.
Swoole\Client::resume
β Resume receiving data.
Swoole\Client::send
β Send data to the remote TCP socket.
Swoole\Client::sendfile
β Send file to the remote TCP socket.
Swoole\Client::sendto
β Send data to the remote UDP address.
Swoole\Client::set
β Set the Swoole client parameters before the connection is established.
Swoole\Client::sleep
β Remove the TCP client from system event loop.
Swoole\Client::wakeup
β Add the TCP client back into the system event loop.
Swoole\Connection\Iterator
β The Swoole\Connection\Iterator class
Swoole\Connection\Iterator::count
β Count connections.
Swoole\Connection\Iterator::current
β Return current connection entry.
Swoole\Connection\Iterator::key
β Return key of the current connection.
Swoole\Connection\Iterator::next
β Move to the next connection.
Swoole\Connection\Iterator::offsetExists
β Check if offset exists.
Swoole\Connection\Iterator::offsetGet
β Offset to retrieve.
Swoole\Connection\Iterator::offsetSet
β Assign a Connection to the specified offset.
Swoole\Connection\Iterator::offsetUnset
β Unset an offset.
Swoole\Connection\Iterator::rewind
β Rewinds iterator
Swoole\Connection\Iterator::valid
β Check if current position is valid.
Swoole\Coroutine
β The Swoole\Coroutine class
Swoole\Coroutine::call_user_func
β Call a callback given by the first parameter
Swoole\Coroutine::call_user_func_array
β Call a callback with an array of parameters
Swoole\Coroutine::cli_wait
β Description
Swoole\Coroutine::create
β Description
Swoole\Coroutine::getuid
β Description
Swoole\Coroutine::resume
β Description
Swoole\Coroutine::suspend
β Description
Swoole\Coroutine\Lock
β The Swoole\Coroutine\Lock class
Swoole\Coroutine\Lock::__construct
β Construct a new coroutine lock
Swoole\Coroutine\Lock::lock
β Acquire the lock, blocking if necessary
Swoole\Coroutine\Lock::trylock
β Attempt to acquire the lock without blocking
Swoole\Coroutine\Lock::unlock
β Release the lock
Swoole\Event
β The Swoole\Event class
Swoole\Event::add
β Add new callback functions of a socket into the EventLoop.
Swoole\Event::defer
β Add a callback function to the next event loop.
Swoole\Event::del
β Remove all event callback functions of a socket.
Swoole\Event::exit
β Exit the eventloop, only available at client side.
Swoole\Event::set
β Update the event callback functions of a socket.
Swoole\Event::wait
β Description
Swoole\Event::write
β Write data to the socket.
Swoole\Exception
β The Swoole\Exception class
Swoole\Http\Client
β The Swoole\Http\Client class
Swoole\Http\Client::addFile
β Add a file to the post form.
Swoole\Http\Client::close
β Close the http connection.
Swoole\Http\Client::__construct
β Construct the async HTTP client.
Swoole\Http\Client::__destruct
β Destruct the HTTP client.
Swoole\Http\Client::download
β Download a file from the remote server.
Swoole\Http\Client::execute
β Send the HTTP request after setting the parameters.
Swoole\Http\Client::get
β Send GET http request to the remote server.
Swoole\Http\Client::isConnected
β Check if the HTTP connection is connected.
Swoole\Http\Client::on
β Register callback function by event name.
Swoole\Http\Client::post
β Send POST http request to the remote server.
Swoole\Http\Client::push
β Push data to websocket client.
Swoole\Http\Client::set
β Update the HTTP client parameters.
Swoole\Http\Client::setCookies
β Set the http request cookies.
Swoole\Http\Client::setData
β Set the HTTP request body data.
Swoole\Http\Client::setHeaders
β Set the HTTP request headers.
Swoole\Http\Client::setMethod
β Set the HTTP request method.
Swoole\Http\Client::upgrade
β Upgrade to websocket protocol.
Swoole\Http\Request
β The Swoole\Http\Request class
Swoole\Http\Request::__destruct
β Destruct the HTTP request.
Swoole\Http\Request::rawcontent
β Get the raw HTTP POST body.
Swoole\Http\Response
β The Swoole\Http\Response class
Swoole\Http\Response::cookie
β Set the cookies of the HTTP response.
Swoole\Http\Response::__destruct
β Destruct the HTTP response.
Swoole\Http\Response::end
β Send data for the HTTP request and finish the response.
Swoole\Http\Response::gzip
β Enable the gzip of response content.
Swoole\Http\Response::header
β Set the HTTP response headers.
Swoole\Http\Response::initHeader
β Init the HTTP response header.
Swoole\Http\Response::rawcookie
β Set the raw cookies to the HTTP response.
Swoole\Http\Response::sendfile
β Send file through the HTTP response.
Swoole\Http\Response::status
β Set the status code of the HTTP response.
Swoole\Http\Response::write
β Append HTTP body content to the HTTP response.
Swoole\Http\Server
β The Swoole\Http\Server class
Swoole\Http\Server::on
β Bind callback function to HTTP server by event name.
Swoole\Http\Server::start
β Start the swoole http server.
Swoole\Lock
β The Swoole\Lock class
Swoole\Lock::__construct
β Construct a memory lock.
Swoole\Lock::__destruct
β Destroy a Swoole memory lock.
Swoole\Lock::lock
β Try to acquire the lock. It will block if the lock is not available.
Swoole\Lock::lock_read
β Lock a read-write lock for reading.
Swoole\Lock::trylock
β Try to acquire the lock and return straight away even the lock is not available.
Swoole\Lock::trylock_read
β Try to lock a read-write lock for reading and return straight away even the lock is not available.
Swoole\Lock::unlock
β Release the lock.
Swoole\Mmap
β The Swoole\Mmap class
Swoole\Mmap::open
β Map a file into memory and return the stream resource which can be used by PHP stream operations.
Swoole\MySQL
β The Swoole\MySQL class
Swoole\MySQL::close
β Close the async MySQL connection.
Swoole\MySQL::connect
β Connect to the remote MySQL server.
Swoole\MySQL::__construct
β Construct an async MySQL client.
Swoole\MySQL::__destruct
β Destroy the async MySQL client.
Swoole\MySQL::getBuffer
β Description
Swoole\MySQL::on
β Register callback function based on event name.
Swoole\MySQL::query
β Run the SQL query.
Swoole\MySQL\Exception
β The Swoole\MySQL\Exception class
Swoole\Process
β The Swoole\Process class
Swoole\Process::alarm
β High precision timer which triggers signal with fixed interval.
Swoole\Process::close
β Close the pipe to the child process.
Swoole\Process::__construct
β Construct a process.
Swoole\Process::daemon
β Change the process to be a daemon process.
Swoole\Process::__destruct
β Destroy the process.
Swoole\Process::exec
β Execute system commands.
Swoole\Process::exit
β Stop the child processes.
Swoole\Process::freeQueue
β Destroy the message queue created by swoole_process::useQueue.
Swoole\Process::kill
β Send signal to the child process.
Swoole\Process::name
β Set name of the process.
Swoole\Process::pop
β Read and pop data from the message queue.
Swoole\Process::push
β Write and push data into the message queue.
Swoole\Process::read
β Read data sending to the process.
Swoole\Process::signal
β Send signal to the child processes.
Swoole\Process::start
β Start the process.
Swoole\Process::statQueue
β Get the stats of the message queue used as the communication method between processes.
Swoole\Process::useQueue
β Create a message queue as the communication method between the parent process and child processes.
Swoole\Process::wait
β Wait for the events of child processes.
Swoole\Process::write
β Write data into the pipe and communicate with the parent process or child processes.
Swoole\Redis\Server
β The Swoole\Redis\Server class
Swoole\Redis\Server::format
β Description
Swoole\Redis\Server::setHandler
β Description
Swoole\Redis\Server::start
β Description
Swoole\Runtime
β The Swoole\Runtime class
Swoole\Runtime::enableCoroutine
β Enable coroutine for specified functions
Swoole\Runtime::getHookFlags
β Get current hook flags
Swoole\Runtime::setHookFlags
β Set hook flags for coroutine
Swoole\Serialize
β The Swoole\Serialize class
Swoole\Serialize::pack
β Serialize the data.
Swoole\Serialize::unpack
β Unserialize the data.
Swoole\Server
β The Swoole\Server class
Swoole\Server::addlistener
β Add a new listener to the server.
Swoole\Server::addProcess
β Add a user defined swoole_process to the server.
Swoole\Server::after
β Trigger a callback function after a period of time.
Swoole\Server::bind
β Bind the connection to a user defined user ID.
Swoole\Server::clearTimer
β Stop and destroy a timer.
Swoole\Server::close
β Close a connection to the client.
Swoole\Server::confirm
β Check status of the connection.
Swoole\Server::connection_info
β Get the connection info by file description.
Swoole\Server::connection_list
β Get all of the established connections.
Swoole\Server::__construct
β Construct a Swoole server.
Swoole\Server::defer
β Delay execution of the callback function at the end of current EventLoop.
Swoole\Server::exist
β Check if the connection is existed.
Swoole\Server::finish
β Used in task process for sending result to the worker process when the task is finished.
Swoole\Server::getClientInfo
β Get the connection info by file description.
Swoole\Server::getClientList
β Get all of the established connections.
Swoole\Server::getLastError
β Get the error code of the most recent error.
Swoole\Server::heartbeat
β Check all the connections on the server.
Swoole\Server::listen
β Listen on the given IP and port, socket type.
Swoole\Server::on
β Register a callback function by event name.
Swoole\Server::pause
β Stop receiving data from the connection.
Swoole\Server::protect
β Set the connection to be protected mode.
Swoole\Server::reload
β Restart all the worker process.
Swoole\Server::resume
β Start receiving data from the connection.
Swoole\Server::send
β Send data to the client.
Swoole\Server::sendfile
β Send file to the connection.
Swoole\Server::sendMessage
β Send message to worker processes by ID.
Swoole\Server::sendto
β Send data to the remote UDP address.
Swoole\Server::sendwait
β Send data to the remote socket in the blocking way.
Swoole\Server::set
β Set the runtime settings of the swoole server.
Swoole\Server::shutdown
β Shutdown the master server process, this function can be called in worker processes.
Swoole\Server::start
β Start the Swoole server.
Swoole\Server::stats
β Get the stats of the Swoole server.
Swoole\Server::stop
β Stop the Swoole server.
Swoole\Server::task
β Send data to the task worker processes.
Swoole\Server::taskwait
β Send data to the task worker processes in blocking way.
Swoole\Server::taskWaitMulti
β Execute multiple tasks concurrently.
Swoole\Server::tick
β Repeats a given function at every given time-interval.
Swoole\Table
β The Swoole\Table class
Swoole\Table::column
β Set the data type and size of the columns.
Swoole\Table::__construct
β Construct a Swoole memory table with fixed size.
Swoole\Table::count
β Count the rows in the table, or count all the elements in the table if $mode = 1.
Swoole\Table::create
β Create the swoole memory table.
Swoole\Table::current
β Get the current row.
Swoole\Table::decr
β Decrement the value in the Swoole table by $key and $column
Swoole\Table::del
β Delete a row in the Swoole table by $key
Swoole\Table::destroy
β Destroy the Swoole table.
Swoole\Table::exist
β Check if a row is existed by $row_key.
Swoole\Table::get
β Get the value in the Swoole table by $key and $field.
Swoole\Table::incr
β Increment the value by $key and $column
Swoole\Table::key
β Get the key of current row.
Swoole\Table::next
β Iterator the next row
Swoole\Table::rewind
β Rewind the iterator.
Swoole\Table::set
β Update a row of the table by $key.
Swoole\Table::valid
β Check if the current row is valid.
Swoole\Timer
β The Swoole\Timer class
Swoole\Timer::after
β Trigger a callback function after a period of time.
Swoole\Timer::clear
β Delete a timer by timer ID.
Swoole\Timer::exists
β Check if a timer is existed.
Swoole\Timer::tick
β Repeats a given function at every given time-interval.
Swoole\WebSocket\Frame
β The Swoole\WebSocket\Frame class
Swoole\WebSocket\Server
β The Swoole\WebSocket\Server class
Swoole\WebSocket\Server::exist
β Check if the file descriptor exists.
Swoole\WebSocket\Server::on
β Register event callback function
Swoole\WebSocket\Server::pack
β Get a pack of binary data to send in a single frame.
Swoole\WebSocket\Server::push
β Push data to the remote client.
Swoole\WebSocket\Server::unpack
β Unpack the binary data received from the client.
Found A Problem?
Learn How To Improve This Page
β’
Submit a Pull Request
β’
Report a Bug
οΌ
add a note
User Contributed Notes
There are no user contributed notes for this page.
0
pcntl_sigtimedwait
Waits for signals, with a timeout
0
similar_text
Calculate the similarity between two strings
0
boolval
Get the boolean value of a variable
0
curl_multi_close
Close a set of cURL handles
0
imap_body
Read the message body
0
mb_strpos
Find position of first occurrence of string in a string
0
pg_send_prepare
Sends a request to create a prepared statement with the given parameters, without waiting for completion
0
swoole_native_socket_bind
0
Arr::prependKeysWith
0
zend_version
Gets the version of the current Zend engine
^