mailmug/zentropy-php

PHP client for Zentropy server

Installs: 3

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mailmug/zentropy-php

1.0.0 2025-10-19 07:46 UTC

This package is not auto-updated.

Last update: 2025-10-20 06:09:13 UTC


README

Latest Stable Version

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

  1. Fork the repository.

  2. Run composer install.

  3. Add tests in tests/ and examples in examples/.

  4. Submit a pull request.