Download the PHP package ikilobyte/pulsar-client-php without Composer
On this page you can find all versions of the php package ikilobyte/pulsar-client-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pulsar-client-php
PHP Native Pulsar Client
Contents
- Contents
- About
- Requirements
- Installation
- Producer
- Consumer
- TLS
- Schema
- Reader
- Options
- MCP Server for AI Agents
- License
About
English | 中文
This is a Apache Pulsar client library implemented in php Reference PulsarApi.proto And support Swoole coroutine
Features
- Support URL (
pulsar://、pulsar+ssl://、http://、https://) - Multi topic consumers
- TLS connection
- Automatic reconnection (Only Consumer)
- Message batching
- Message Properties
- Compression with
zstd,zlib,lz4,snappy - Authentication with
jwt,basic
Requirements
- PHP >=7.1
- ZLib Extension(If you want to use
zlibcompression) - Zstd Extension(If you want to use
zstdcompression) - LZ4 Extension(If you want to use
lz4compression) - Snappy Extension(If you want to use
snappycompression) - Swoole Extension(If you want to use in swoole)
- Use in the swoole only requires that the
SWOOLE_HOOK_SOCKETS、SWOOLE_HOOK_STREAM_FUNCTIONorSWOOLE_HOOK_ALL
- Use in the swoole only requires that the
Tips
If the following error occurs, please install extension
gmporbcmath
Installation
Producer
Keepalive Connection (Recommended)
- require
Swooleextension - If it is a resident memory application, it is recommended to open it.
- Will keep connected, no need to repeatedly establish a connection
- Calling the
closemethod closes the connection - Please see example
Message deduplication
- Message de-duplication is a feature provided by pulsar and is based on the producer name and sequence number ID
- The name of the same producer needs to be fixed and unique, generally distinguished by business latitude, and the sequence number ID of each message is unique and self-incrementing.
- Reference Pulsar Docs
Consumer
Receive Batch Message
- Only when the producer sends the message in bulk can the batch message be received.
Subscribe to multiple topics
Dead letter topic
Reconnect(Only Support Consumer)
Not loop Receive And Smooth exit
TLS
-
Refer to the official documentation for certificate configuration
- Example
Schema
- Currently only supports
INT8、INT16、INT32、INT64、DOUBLE、STRING、JSON,The following code usesJSON Schemaas an example - https://pulsar.apache.org/docs/2.11.x/schema-overview/
-
model.php -
Producer Statement Schema
- Consumer Statement Schema
Reader
Options
- ProducerOptions
- setTopic()
- setAuthentication()
- setConnectTimeout()
- setProducerName()
- setCompression()
- setSchema()
- setKeepalive()
- ConsumerOptions
- setTopic()
- setTopics()
- setAuthentication()
- setConnectTimeout()
- setConsumerName()
- setSubscription()
- setSubscriptionType()
- setNackRedeliveryDelay()
- setReceiveQueueSize()
- setDeadLetterPolicy()
- setSubscriptionInitialPosition()
- setReconnectPolicy()
- setSchema()
- ReaderOptions
- setTopic()
- setAuthentication()
- setConnectTimeout()
- setReaderName()
- setStartMessageID()
- setReceiveQueueSize()
- MessageOptions
- DELAY_SECONDS
- SEQUENCE_ID
- PROPERTIES
- TLSOption (v1.3.0)
- __construct(string $certFilePath, string $keyFilePath)
- setTrustCertsFilePath()
- setValidateHostname()
- setAllowInsecureConnection()
MessageNotFound ErrCode (v1.2.1)
MessageNotFound::IgnoreMessageNotFound::CommandParseFail
MCP Server for AI Agents
This library includes an MCP (Model Context Protocol) stdio server that lets AI agents (Cursor, Claude Desktop, etc.) produce, consume, and peek at Pulsar messages. No extra dependencies required.
Tools: pulsar_publish · pulsar_consume · pulsar_peek
Quick setup — add to ~/.cursor/mcp.json (Cursor) or claude_desktop_config.json (Claude Desktop):
See examples/mcp.md for full tool reference and testing instructions.
License
MIT LICENSE
All versions of pulsar-client-php with dependencies
google/crc32 Version ^0.1.0
protobuf-php/protobuf Version ^0.1.3
ext-curl Version *