Swoole

目次

The Swoole\Async class

はじめに

クラス概要

Swoole\Async
class Swoole\Async {
/* メソッド */
public static void dnsLookup(string $hostname, callable $callback)
public static bool read(
    string $filename,
    callable $callback,
    int $chunk_size = ?,
    int $offset = ?
)
public static void readFile(string $filename, callable $callback)
public static void set(array $settings)
public static void write(
    string $filename,
    string $content,
    int $offset = ?,
    callable $callback = ?
)
public static void writeFile(
    string $filename,
    string $content,
    callable $callback = ?,
    string $flags = ?
)
}

The Swoole\Atomic class

はじめに

クラス概要

Swoole\Atomic
class Swoole\Atomic {
/* メソッド */
public int add(int $add_value = ?)
public int cmpset(int $cmp_value, int $new_value)
public int get()
public int set(int $value)
public int sub(int $sub_value = ?)
}

The Swoole\Buffer class

はじめに

クラス概要

Swoole\Buffer
class Swoole\Buffer {
/* メソッド */
public int append(string $data)
public void clear()
public void __destruct()
public int expand(int $size)
public string read(int $offset, int $length)
public void recycle()
public string substr(int $offset, int $length = ?, bool $remove = ?)
public string __toString()
public void write(int $offset, string $data)
}

The Swoole\Channel class

はじめに

クラス概要

Swoole\Channel
class Swoole\Channel {
/* メソッド */
public void __destruct()
public mixed pop()
public bool push(string $data)
public array stats()
}

The Swoole\Client class

はじめに

クラス概要

Swoole\Client
class Swoole\Client {
/* 定数 */
const int Swoole\Client::MSG_OOB = 1;
const int Swoole\Client::MSG_PEEK = 2;
const int Swoole\Client::MSG_DONTWAIT = 128;
const int Swoole\Client::MSG_WAITALL = 64;
/* プロパティ */
public $errCode;
public $sock;
public $reuse;
public $reuseCount;
/* メソッド */
public bool close(bool $force = ?)
public bool connect(
    string $host,
    int $port = ?,
    int $timeout = ?,
    int $flag = ?
)
public void __destruct()
public array getpeername()
public array getsockname()
public bool isConnected()
public void on(string $event, callable $callback)
public void pause()
public void pipe(string $socket)
public void recv(string $size = ?, string $flag = ?)
public void resume()
public int send(string $data, string $flag = ?)
public bool sendfile(string $filename, int $offset = ?)
public bool sendto(string $ip, int $port, string $data)
public void set(array $settings)
public void sleep()
public void wakeup()
}

プロパティ

errCode

sock

reuse

reuseCount

定義済み定数

Swoole\Client::MSG_OOB

Swoole\Client::MSG_PEEK

Swoole\Client::MSG_DONTWAIT

Swoole\Client::MSG_WAITALL

The Swoole\Connection\Iterator class

はじめに

クラス概要

Swoole\Connection\Iterator
class Swoole\Connection\Iterator implements Iterator, Countable, ArrayAccess {
/* メソッド */
public int count()
public Connection current()
public int key()
public Connection next()
public bool offsetExists(int $index)
public Connection offsetGet(string $index)
public void offsetSet(int $offset, mixed $connection)
public void offsetUnset(int $offset)
public void rewind()
public bool valid()
}

The Swoole\Coroutine class

はじめに

クラス概要

Swoole\Coroutine
class Swoole\Coroutine {
/* メソッド */
public static mixed call_user_func_array(callable $callback, array $param_array)
public static mixed call_user_func(callable $callback, mixed ...$args)
public static ReturnType cli_wait()
public static ReturnType create()
public ReturnType Swoole\Coroutine\Client::close()
public ReturnType Swoole\Coroutine\Client::connect()
public ReturnType Swoole\Coroutine\Client::__destruct()
public ReturnType Swoole\Coroutine\Client::getpeername()
public ReturnType Swoole\Coroutine\Client::getsockname()
public ReturnType Swoole\Coroutine\Client::isConnected()
public ReturnType Swoole\Coroutine\Client::recv()
public ReturnType Swoole\Coroutine\Client::send()
public ReturnType Swoole\Coroutine\Client::sendfile()
public ReturnType Swoole\Coroutine\Client::sendto()
public ReturnType Swoole\Coroutine\Client::set()
public ReturnType Swoole\Coroutine\Http\Client::addFile()
public ReturnType Swoole\Coroutine\Http\Client::close()
public ReturnType Swoole\Coroutine\Http\Client::__destruct()
public ReturnType Swoole\Coroutine\Http\Client::execute()
public ReturnType Swoole\Coroutine\Http\Client::get()
public ReturnType Swoole\Coroutine\Http\Client::getDefer()
public ReturnType Swoole\Coroutine\Http\Client::isConnected()
public ReturnType Swoole\Coroutine\Http\Client::post()
public ReturnType Swoole\Coroutine\Http\Client::recv()
public ReturnType Swoole\Coroutine\Http\Client::set()
public ReturnType Swoole\Coroutine\Http\Client::setCookies()
public ReturnType Swoole\Coroutine\Http\Client::setData()
public ReturnType Swoole\Coroutine\Http\Client::setDefer()
public ReturnType Swoole\Coroutine\Http\Client::setHeaders()
public ReturnType Swoole\Coroutine\Http\Client::setMethod()
public ReturnType Swoole\Coroutine\MySQL::close()
public ReturnType Swoole\Coroutine\MySQL::connect()
public ReturnType Swoole\Coroutine\MySQL::__destruct()
public ReturnType Swoole\Coroutine\MySQL::getDefer()
public ReturnType Swoole\Coroutine\MySQL::query()
public ReturnType Swoole\Coroutine\MySQL::recv()
public ReturnType Swoole\Coroutine\MySQL::setDefer()
public static ReturnType getuid()
public static ReturnType resume()
public static ReturnType suspend()
}

The Swoole\Event class

はじめに

クラス概要

Swoole\Event
class Swoole\Event {
/* メソッド */
public static bool add(
    int $fd,
    callable $read_callback,
    callable $write_callback = ?,
    string $events = ?
)
public static void defer(mixed $callback)
public static bool del(string $fd)
public static void exit()
public static bool set(
    int $fd,
    string $read_callback = ?,
    string $write_callback = ?,
    string $events = ?
)
public static void wait()
public static void write(string $fd, string $data)
}

The Swoole\Exception class

はじめに

クラス概要

Swoole\Exception
class Swoole\Exception extends Exception implements Throwable {
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private Throwablenull $previous = null;
}

The Swoole\Http\Client class

はじめに

クラス概要

Swoole\Http\Client
class Swoole\Http\Client {
/* プロパティ */
public $errCode;
public $sock;
/* メソッド */
public void addFile(
    string $path,
    string $name,
    string $type = ?,
    string $filename = ?,
    string $offset = ?
)
public void close()
public void __destruct()
public void download(
    string $path,
    string $file,
    callable $callback,
    int $offset = ?
)
public void execute(string $path, string $callback)
public void get(string $path, callable $callback)
public bool isConnected()
public void on(string $event_name, callable $callback)
public void post(string $path, string $data, callable $callback)
public void push(string $data, string $opcode = ?, string $finish = ?)
public void set(array $settings)
public void setCookies(array $cookies)
public ReturnType setData(string $data)
public void setHeaders(array $headers)
public void setMethod(string $method)
public void upgrade(string $path, string $callback)
}

プロパティ

errCode

sock

The Swoole\Http\Request class

はじめに

クラス概要

Swoole\Http\Request
class Swoole\Http\Request {
/* メソッド */
public void __destruct()
public string rawcontent()
}

The Swoole\Http\Response class

はじめに

クラス概要

Swoole\Http\Response
class Swoole\Http\Response {
/* メソッド */
public string cookie(
    string $name,
    string $value = ?,
    string $expires = ?,
    string $path = ?,
    string $domain = ?,
    string $secure = ?,
    string $httponly = ?
)
public void __destruct()
public void end(string $content = ?)
public ReturnType gzip(string $compress_level = ?)
public void header(string $key, string $value, string $ucwords = ?)
public ReturnType initHeader()
public ReturnType rawcookie(
    string $name,
    string $value = ?,
    string $expires = ?,
    string $path = ?,
    string $domain = ?,
    string $secure = ?,
    string $httponly = ?
)
public ReturnType sendfile(string $filename, int $offset = ?)
public ReturnType status(string $http_code)
public void write(string $content)
}

The Swoole\Http\Server class

はじめに

クラス概要

Swoole\Http\Server
class Swoole\Http\Server extends Swoole\Server {
/* メソッド */
public void on(string $event_name, callable $callback)
public void start()
/* 継承したメソッド */
public void Swoole\Server::addlistener(string $host, int $port, string $socket_type)
public bool Swoole\Server::addProcess(swoole_process $process)
public ReturnType Swoole\Server::after(int $after_time_ms, callable $callback, string $param = ?)
public bool Swoole\Server::bind(int $fd, int $uid)
public void Swoole\Server::clearTimer(int $timer_id)
void swoole_timer_clear(int $timer_id)
public bool Swoole\Server::close(int $fd, bool $reset = ?)
public bool Swoole\Server::confirm(int $fd)
public array Swoole\Server::connection_info(int $fd, int $reactor_id = ?)
public array Swoole\Server::connection_list(int $start_fd, int $pagesize = ?)
public void Swoole\Server::defer(callable $callback)
public void Swoole\Server\Port::__destruct()
public ReturnType Swoole\Server\Port::on(string $event_name, callable $callback)
public void Swoole\Server\Port::set(array $settings)
public bool Swoole\Server::exist(int $fd)
public void Swoole\Server::finish(string $data)
public array Swoole\Server::getClientInfo(int $fd, int $reactor_id = ?, bool $ignore_error = ?)
public array Swoole\Server::getClientList(int $start_fd, int $pagesize = ?)
public int Swoole\Server::getLastError()
public mixed Swoole\Server::heartbeat(bool $if_close_connection)
public bool Swoole\Server::listen(string $host, int $port, string $socket_type)
public void Swoole\Server::on(string $event_name, callable $callback)
public void Swoole\Server::pause(int $fd)
public void Swoole\Server::protect(int $fd, bool $is_protected = ?)
public bool Swoole\Server::reload()
public void Swoole\Server::resume(int $fd)
public bool Swoole\Server::send(int $fd, string $data, int $reactor_id = ?)
public bool Swoole\Server::sendfile(int $fd, string $filename, int $offset = ?)
public bool Swoole\Server::sendMessage(int $worker_id, string $data)
public bool Swoole\Server::sendto(
    string $ip,
    int $port,
    string $data,
    string $server_socket = ?
)
public bool Swoole\Server::sendwait(int $fd, string $data)
public ReturnType Swoole\Server::set(array $settings)
public void Swoole\Server::shutdown()
public void Swoole\Server::start()
public array Swoole\Server::stats()
public bool Swoole\Server::stop(int $worker_id = ?)
public mixed Swoole\Server::task(string $data, int $dst_worker_id = ?, callable $callback = ?)
public void Swoole\Server::taskwait(string $data, float $timeout = ?, int $worker_id = ?)
public void Swoole\Server::taskWaitMulti(array $tasks, float $timeout_ms = ?)
public void Swoole\Server::tick(int $interval_ms, callable $callback)
}

The Swoole\Lock class

はじめに

クラス概要

Swoole\Lock
class Swoole\Lock {
/* メソッド */
public void __destruct()
public void lock_read()
public void lock()
public void trylock_read()
public void trylock()
public void unlock()
}

The Swoole\Mmap class

はじめに

クラス概要

Swoole\Mmap
class Swoole\Mmap {
/* メソッド */
public static ReturnType open(string $filename, string $size = ?, string $offset = ?)
}

The Swoole\MySQL class

はじめに

クラス概要

Swoole\MySQL
class Swoole\MySQL {
/* メソッド */
public void close()
public void connect(array $server_config, callable $callback)
public void __destruct()
public ReturnType getBuffer()
public void on(string $event_name, callable $callback)
public ReturnType query(string $sql, callable $callback)
}

The Swoole\MySQL\Exception class

はじめに

クラス概要

Swoole\MySQL\Exception
class Swoole\MySQL\Exception extends Exception implements Throwable {
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private Throwablenull $previous = null;
}

The Swoole\Process class

はじめに

クラス概要

Swoole\Process
class Swoole\Process {
/* 定数 */
const int Swoole\Process::IPC_NOWAIT = 256;
/* メソッド */
public static void alarm(int $interval_usec)
public void close()
public static void daemon(bool $nochdir = ?, bool $noclose = ?)
public void __destruct()
public ReturnType exec(string $exec_file, string $args)
public void exit(string $exit_code = ?)
public void freeQueue()
public static bool kill(int $pid, int $signal_no = ?)
public bool name(string $process_name)
public mixed pop(int $maxsize = ?)
public bool push(string $data)
public string read(int $maxsize = ?)
public static void signal(string $signal_no, callable $callback)
public void start()
public array statQueue()
public bool useQueue(int $key, int $mode = ?)
public static array wait(bool $blocking = ?)
public int write(string $data)
}

定義済み定数

Swoole\Process::IPC_NOWAIT

The Swoole\Redis\Server class

はじめに

クラス概要

Swoole\Redis\Server
class Swoole\Redis\Server extends Swoole\Server {
/* 定数 */
const int Swoole\Redis\Server::NIL = 1;
const int Swoole\Redis\Server::ERROR = 0;
const int Swoole\Redis\Server::STATUS = 2;
const int Swoole\Redis\Server::INT = 3;
const int Swoole\Redis\Server::STRING = 4;
const int Swoole\Redis\Server::SET = 5;
const int Swoole\Redis\Server::MAP = 6;
/* メソッド */
public static ReturnType format(string $type, string $value = ?)
public ReturnType setHandler(
    string $command,
    string $callback,
    string $number_of_string_param = ?,
    string $type_of_array_param = ?
)
public ReturnType start()
/* 継承したメソッド */
public void Swoole\Server::addlistener(string $host, int $port, string $socket_type)
public bool Swoole\Server::addProcess(swoole_process $process)
public ReturnType Swoole\Server::after(int $after_time_ms, callable $callback, string $param = ?)
public bool Swoole\Server::bind(int $fd, int $uid)
public void Swoole\Server::clearTimer(int $timer_id)
void swoole_timer_clear(int $timer_id)
public bool Swoole\Server::close(int $fd, bool $reset = ?)
public bool Swoole\Server::confirm(int $fd)
public array Swoole\Server::connection_info(int $fd, int $reactor_id = ?)
public array Swoole\Server::connection_list(int $start_fd, int $pagesize = ?)
public void Swoole\Server::defer(callable $callback)
public void Swoole\Server\Port::__destruct()
public ReturnType Swoole\Server\Port::on(string $event_name, callable $callback)
public void Swoole\Server\Port::set(array $settings)
public bool Swoole\Server::exist(int $fd)
public void Swoole\Server::finish(string $data)
public array Swoole\Server::getClientInfo(int $fd, int $reactor_id = ?, bool $ignore_error = ?)
public array Swoole\Server::getClientList(int $start_fd, int $pagesize = ?)
public int Swoole\Server::getLastError()
public mixed Swoole\Server::heartbeat(bool $if_close_connection)
public bool Swoole\Server::listen(string $host, int $port, string $socket_type)
public void Swoole\Server::on(string $event_name, callable $callback)
public void Swoole\Server::pause(int $fd)
public void Swoole\Server::protect(int $fd, bool $is_protected = ?)
public bool Swoole\Server::reload()
public void Swoole\Server::resume(int $fd)
public bool Swoole\Server::send(int $fd, string $data, int $reactor_id = ?)
public bool Swoole\Server::sendfile(int $fd, string $filename, int $offset = ?)
public bool Swoole\Server::sendMessage(int $worker_id, string $data)
public bool Swoole\Server::sendto(
    string $ip,
    int $port,
    string $data,
    string $server_socket = ?
)
public bool Swoole\Server::sendwait(int $fd, string $data)
public ReturnType Swoole\Server::set(array $settings)
public void Swoole\Server::shutdown()
public void Swoole\Server::start()
public array Swoole\Server::stats()
public bool Swoole\Server::stop(int $worker_id = ?)
public mixed Swoole\Server::task(string $data, int $dst_worker_id = ?, callable $callback = ?)
public void Swoole\Server::taskwait(string $data, float $timeout = ?, int $worker_id = ?)
public void Swoole\Server::taskWaitMulti(array $tasks, float $timeout_ms = ?)
public void Swoole\Server::tick(int $interval_ms, callable $callback)
}

定義済み定数

Swoole\Redis\Server::NIL

Swoole\Redis\Server::ERROR

Swoole\Redis\Server::STATUS

Swoole\Redis\Server::INT

Swoole\Redis\Server::STRING

Swoole\Redis\Server::SET

Swoole\Redis\Server::MAP

The Swoole\Serialize class

はじめに

クラス概要

Swoole\Serialize
class Swoole\Serialize {
/* メソッド */
public static ReturnType pack(string $data, int $is_fast = ?)
public static ReturnType unpack(string $data, string $args = ?)
}

The Swoole\Server class

はじめに

クラス概要

Swoole\Server
class Swoole\Server {
/* メソッド */
public void addlistener(string $host, int $port, string $socket_type)
public bool addProcess(swoole_process $process)
public ReturnType after(int $after_time_ms, callable $callback, string $param = ?)
public bool bind(int $fd, int $uid)
public void clearTimer(int $timer_id)
void swoole_timer_clear(int $timer_id)
public bool close(int $fd, bool $reset = ?)
public bool confirm(int $fd)
public array connection_info(int $fd, int $reactor_id = ?)
public array connection_list(int $start_fd, int $pagesize = ?)
public void defer(callable $callback)
public void Swoole\Server\Port::__destruct()
public ReturnType Swoole\Server\Port::on(string $event_name, callable $callback)
public void Swoole\Server\Port::set(array $settings)
public bool exist(int $fd)
public void finish(string $data)
public array getClientInfo(int $fd, int $reactor_id = ?, bool $ignore_error = ?)
public array getClientList(int $start_fd, int $pagesize = ?)
public int getLastError()
public mixed heartbeat(bool $if_close_connection)
public bool listen(string $host, int $port, string $socket_type)
public void on(string $event_name, callable $callback)
public void pause(int $fd)
public void protect(int $fd, bool $is_protected = ?)
public bool reload()
public void resume(int $fd)
public bool send(int $fd, string $data, int $reactor_id = ?)
public bool sendfile(int $fd, string $filename, int $offset = ?)
public bool sendMessage(int $worker_id, string $data)
public bool sendto(
    string $ip,
    int $port,
    string $data,
    string $server_socket = ?
)
public bool sendwait(int $fd, string $data)
public ReturnType set(array $settings)
public void shutdown()
public void start()
public array stats()
public bool stop(int $worker_id = ?)
public mixed task(string $data, int $dst_worker_id = ?, callable $callback = ?)
public void taskwait(string $data, float $timeout = ?, int $worker_id = ?)
public void taskWaitMulti(array $tasks, float $timeout_ms = ?)
public void tick(int $interval_ms, callable $callback)
}

The Swoole\Table class

はじめに

クラス概要

Swoole\Table
class Swoole\Table implements Iterator, Countable {
/* 定数 */
const int Swoole\Table::TYPE_INT = 1;
const int Swoole\Table::TYPE_STRING = 7;
const int Swoole\Table::TYPE_FLOAT = 6;
/* メソッド */
public ReturnType column(string $name, string $type, int $size = ?)
public int count()
public void create()
public array current()
public ReturnType decr(string $key, string $column, int $decrby = ?)
public void del(string $key)
public void destroy()
public bool exist(string $key)
public int get(string $row_key, string $column_key)
public void incr(string $key, string $column, int $incrby = ?)
public string key()
public ReturnType next()
public void rewind()
public VOID set(string $key, array $value)
public bool valid()
}

定義済み定数

Swoole\Table::TYPE_INT

Swoole\Table::TYPE_STRING

Swoole\Table::TYPE_FLOAT

The Swoole\Timer class

はじめに

クラス概要

Swoole\Timer
class Swoole\Timer {
/* メソッド */
public static void after(int $after_time_ms, callable $callback)
public static void clear(int $timer_id)
public static bool exists(int $timer_id)
public static void tick(int $interval_ms, callable $callback, string $param = ?)
}

The Swoole\WebSocket\Frame class

はじめに

クラス概要

Swoole\WebSocket\Frame
class Swoole\WebSocket\Frame {
/* メソッド */
}

The Swoole\WebSocket\Server class

はじめに

クラス概要

Swoole\WebSocket\Server
class Swoole\WebSocket\Server extends Swoole\Http\Server {
/* メソッド */
public bool exist(int $fd)
public ReturnType on(string $event_name, callable $callback)
public static binary pack(
    string $data,
    string $opcode = ?,
    string $finish = ?,
    string $mask = ?
)
public void push(
    string $fd,
    string $data,
    string $opcode = ?,
    string $finish = ?
)
public static string unpack(binary $data)
/* 継承したメソッド */
public void Swoole\Http\Server::on(string $event_name, callable $callback)
public void Swoole\Http\Server::start()
}