mailmug/zentropy-php
最新稳定版本:v1.1.3
Composer 安装命令:
composer require mailmug/zentropy-php
包简介
PHP client for Zentropy server
关键字:
README 文档
README
A simple and professional PHP client for Zentropy. Supports TCP connections with authentication and Unix socket connections.
Features
- Connect to Zentropy server over TCP or Unix socket.
- Optional password authentication for TCP connections.
- Common commands:
SET,GET,DELETE,EXISTS,PING. - Easy to integrate in any PHP project, including Laravel.
- Minimal dependencies, PSR-4 autoloading.
Installation
Use Composer to install:
composer require mailmug/zentropy-php
Usage
TCP Connection (with optional password)
<?php require 'vendor/autoload.php'; use Zentropy\Client; $client = Client::tcp('127.0.0.1', 6383, 'pass@123'); $client->set('foo', 'bar'); echo $client->get('foo'); // Outputs: bar $client->close();
Unix Socket Connection
<?php require 'vendor/autoload.php'; use Zentropy\Client; $client = Client::unixSocket('/tmp/zentropy.sock'); $client->set('foo', 'bar'); echo $client->get('foo'); // Outputs: bar $client->close();
API Reference
| Method | Description |
|---|---|
Client::tcp($host, $port, $password) |
Create a TCP client with optional password. |
Client::unixSocket($path) |
Create a client using a Unix socket. |
set(string $key, string $value) |
Set a key-value pair. |
get(string $key) |
Get the value of a key. Returns null if key doesn't exist. |
delete(string $key) |
Delete a key. Returns true if successful. |
exists(string $key) |
Check if a key exists. |
ping() |
Ping the server. Returns true if alive. |
close() |
Close the connection. |
auth(string $password) |
Authenticate TCP connection (internal for TCP only). |
Running Examples
Contributing
-
Fork the repository.
-
Run composer install.
-
Add tests in tests/ and examples in examples/.
-
Submit a pull request.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-24