Download the PHP package shibudb-org/shibudb-client-php without Composer
On this page you can find all versions of the php package shibudb-org/shibudb-client-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shibudb-org/shibudb-client-php
More information about shibudb-org/shibudb-client-php
Files in shibudb-org/shibudb-client-php
Package shibudb-client-php
Short Description A comprehensive PHP client for ShibuDb database with authentication, key-value operations, vector similarity search, and connection pooling
License MIT
Homepage https://github.com/shibudb-org/shibudb-clients
Informations about the package shibudb-client-php
shibudb-client-php
ShibuDb client library for PHP
ShibuDb PHP Client
A comprehensive PHP client for ShibuDb database that supports authentication, key-value operations, vector similarity search, space management, and connection pooling. Compatible with PHP 5.6+.
Features
- 🔐 Authentication & User Management: Secure login with role-based access control
- 🔑 Key-Value Operations: Traditional key-value storage with PUT, GET, DELETE operations
- 🧮 Vector Similarity Search: Advanced vector operations with multiple index types
- 🗂️ Space Management: Create, delete, and manage different storage spaces
- 🛡️ Error Handling: Comprehensive error handling with custom exceptions
- 📊 Connection Management: Automatic connection handling with destructors
- 🔗 Connection Pooling: High-performance connection pooling for concurrent operations
Installation
Prerequisites
-
ShibuDb Server: Ensure the ShibuDb server is running
- PHP Requirements:
- PHP 5.6 or higher
- No external PHP extensions required (uses built-in
stream_socket_client,json_encode,json_decode)
Setup
Composer (Recommended)
Then in your PHP code:
Manual Installation
-
Copy the client file to your project:
- Include the client:
Quick Start
Basic Connection and Authentication
Convenience Function
Connection Pooling
Key-Value Operations
Vector Operations
API Reference
ShibuDbClient
Constructor
Authentication
Space Management
Key-Value Operations
Vector Operations
User Management (Admin Only)
Data Models
User Array
Exceptions
ShibuDbException: Base exception for all client errorsShibuDbAuthenticationError: Raised when authentication failsShibuDbConnectionError: Raised when connection failsShibuDbQueryError: Raised when query execution failsShibuDbPoolExhaustedError: Raised when connection pool is exhausted
Examples
Complete Example
Error Handling
Advanced Usage
Running Examples
Simple Test
Comprehensive Examples
Connection Pooling Examples
Comprehensive Connection Pooling Tests
Connection Pooling
The ShibuDb client supports connection pooling for high-performance concurrent operations. Connection pooling provides:
- Connection Reuse: Efficiently reuse database connections
- Concurrent Operations: Support for multiple simultaneous operations
- Automatic Health Checks: Health monitoring of connections
- Configurable Pool Size: Adjustable minimum and maximum pool sizes
- Timeout Handling: Configurable connection acquisition timeouts
Pool Configuration
Using Connection Pools
Pool Statistics
Error Handling with Pools
Engine Types
Key-Value Engine
- Traditional key-value storage
- Supports PUT, GET, DELETE operations
- No dimension required
Vector Engine
- Vector similarity search
- Multiple index types:
- Flat: Exact search (default)
- HNSW: Hierarchical Navigable Small World
- IVF: Inverted File Index
- IVF with PQ: Product Quantization
- Distance metrics:
- L2: Euclidean distance (default)
- IP: Inner product
- COS: Cosine similarity
Security
- Authentication Required: All operations require valid credentials
- Role-Based Access: Admin and user roles with different permissions
- Space-Level Permissions: Read/write permissions per space
- Connection Security: TCP-based communication with timeout handling
PHP 5.6 Compatibility
This client is designed for PHP 5.6+ compatibility:
- No scalar type hints (PHP 7+ feature)
- No return type declarations (PHP 7+ feature)
- No null coalescing operator (
??) (PHP 7+ feature) - Uses
array()syntax for clarity - Compatible with
json_decode()strictness in PHP 5.6 - Uses built-in PHP functions only (no external dependencies)
Troubleshooting
Common Issues
-
Connection Failed
- Ensure ShibuDb server is running:
sudo shibudb start 4444 - Check server port and host settings
- Verify firewall settings
- Check PHP error logs for connection errors
- Ensure ShibuDb server is running:
-
Authentication Failed
- Verify username and password
- Ensure user exists in the system
- Check user permissions
-
Space Not Found
- Use
listSpaces()to see available spaces - Create space before using:
createSpace() - Use
useSpace()to switch to a space
- Use
-
Vector Dimension Mismatch
- Ensure vector dimension matches space dimension
- Check space creation parameters
- Verify vector format (array of floats)
- JSON Parsing Errors
- Check PHP version compatibility (PHP 5.6+)
- Verify JSON response format from server
- Check for special characters in data
Debug Mode
Enable PHP error reporting:
Running Tests
Tests mirror the Python client test structure:
| Test File | Description | Server Required |
|---|---|---|
simple_test.php |
Basic key-value and vector operations | Yes |
pool_test.php |
Connection pooling basics | Yes |
comprehensive_pool_test.php |
Full pool tests (stats, configs, errors) | Yes |
json_parsing_test.php |
JSON parsing with special chars, fallback | No |
special_chars_test.php |
Special character handling, encoding | No |
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure PHP 5.6+ compatibility
- Submit a pull request
License
This client is provided as-is for use with ShibuDb database.