ConnectManager
in package
implements
ConnectManagerInterface
Унифицированный менеджер сетевых соединений (sync + async + HTTP + SSH/SFTP).
Tags
Table of Contents
Interfaces
- ConnectManagerInterface
- Публичный фасад Connect Manager.
Constants
- VERSION : mixed = '1.1.0'
- Версия API пакета (SemVer совместимости; релиз — через Packagist/git tag).
Methods
- __construct() : mixed
- abort() : never
- Завершает работу с ошибкой пакета.
- async() : AsyncRuntimeInterface
- Возвращает асинхронный рантайм.
- connect() : ConnectionInterface
- Открывает соединение указанного протокола.
- connectAsync() : mixed
- Открывает соединение асинхронно внутри Fiber-рантайма.
- http() : HttpClient
- Прикладной HTTP-клиент (get/post/json/redirects).
- httpExchange() : string
- HTTP/1.1 обмен поверх уже открытого соединения.
- name() : string
- Возвращает идентификатор пакета Composer.
- pool() : ConnectionPoolInterface
- Возвращает пул соединений.
- protocols() : ProtocolRegistryInterface
- Возвращает реестр протоколов.
- request() : HttpResponse
- Выполняет HTTP-запрос по URL.
- sftp() : SftpClient
- Открывает прикладное SFTP-соединение и возвращает клиент.
- ssh() : SshConnection
- Открывает прикладное SSH-соединение.
Constants
VERSION
Версия API пакета (SemVer совместимости; релиз — через Packagist/git tag).
public
mixed
VERSION
= '1.1.0'
Methods
__construct()
public
__construct([ProtocolRegistryInterface|null $registry = null ][, ConnectionFactoryInterface|null $factory = null ][, ConnectionPoolInterface|null $pool = null ][, AsyncRuntimeInterface|null $async = null ][, HttpClient|null $http = null ]) : mixed
Parameters
- $registry : ProtocolRegistryInterface|null = null
-
Реестр протоколов
- $factory : ConnectionFactoryInterface|null = null
-
Фабрика соединений
- $pool : ConnectionPoolInterface|null = null
-
Пул
- $async : AsyncRuntimeInterface|null = null
-
Async-рантайм
- $http : HttpClient|null = null
-
HTTP-клиент
abort()
Завершает работу с ошибкой пакета.
public
abort(string $message) : never
Parameters
- $message : string
Tags
Return values
neverasync()
Возвращает асинхронный рантайм.
public
async() : AsyncRuntimeInterface
Attributes
- #[Override]
Return values
AsyncRuntimeInterfaceconnect()
Открывает соединение указанного протокола.
public
connect(string $protocolId, string $endpoint[, ConnectionOptions|null $options = null ]) : ConnectionInterface
Parameters
- $protocolId : string
- $endpoint : string
- $options : ConnectionOptions|null = null
Attributes
- #[Override]
Return values
ConnectionInterfaceconnectAsync()
Открывает соединение асинхронно внутри Fiber-рантайма.
public
connectAsync(string $protocolId, string $endpoint, callable $onConnected[, ConnectionOptions|null $options = null ]) : mixed
Устанавливает соединение в non-blocking режиме (STREAM_CLIENT_ASYNC_CONNECT) с опросом готовности через async-рантайм.
Parameters
- $protocolId : string
- $endpoint : string
- $onConnected : callable
- $options : ConnectionOptions|null = null
Attributes
- #[Override]
http()
Прикладной HTTP-клиент (get/post/json/redirects).
public
http() : HttpClient
Return values
HttpClienthttpExchange()
HTTP/1.1 обмен поверх уже открытого соединения.
public
httpExchange(ConnectionInterface $connection, string $method, string $target[, array<string, string> $headers = [] ][, string $body = '' ][, string $hostHeader = '' ]) : string
Parameters
- $connection : ConnectionInterface
- $method : string
- $target : string
- $headers : array<string, string> = []
- $body : string = ''
- $hostHeader : string = ''
Return values
stringname()
Возвращает идентификатор пакета Composer.
public
name() : string
Attributes
- #[Override]
Return values
stringpool()
Возвращает пул соединений.
public
pool() : ConnectionPoolInterface
Attributes
- #[Override]
Return values
ConnectionPoolInterfaceprotocols()
Возвращает реестр протоколов.
public
protocols() : ProtocolRegistryInterface
Attributes
- #[Override]
Return values
ProtocolRegistryInterfacerequest()
Выполняет HTTP-запрос по URL.
public
request(HttpRequest $request[, ConnectionOptions|null $options = null ]) : HttpResponse
Parameters
- $request : HttpRequest
- $options : ConnectionOptions|null = null
Return values
HttpResponsesftp()
Открывает прикладное SFTP-соединение и возвращает клиент.
public
sftp(string $endpoint, AuthCredentials $auth[, ConnectionOptions|null $options = null ]) : SftpClient
Parameters
- $endpoint : string
- $auth : AuthCredentials
- $options : ConnectionOptions|null = null
Tags
Return values
SftpClientssh()
Открывает прикладное SSH-соединение.
public
ssh(string $endpoint, AuthCredentials $auth[, ConnectionOptions|null $options = null ]) : SshConnection
Parameters
- $endpoint : string
- $auth : AuthCredentials
- $options : ConnectionOptions|null = null