Download the PHP package dbellettini/eventstore-client without Composer
On this page you can find all versions of the php package dbellettini/eventstore-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dbellettini/eventstore-client
More information about dbellettini/eventstore-client
Files in dbellettini/eventstore-client
Package eventstore-client
Short Description KurrentDB client for PHP (core)
License MIT
Informations about the package eventstore-client
KurrentDB PHP Client
A modern PHP client library for KurrentDB (formerly EventStoreDB) HTTP API, designed for event sourcing applications.
Note: This library uses the HTTP API. For TCP integration, see prooph/event-store-client.
Features
- ✅ Support for KurrentDB HTTP API
- ✅ Event stream management (read, write, delete)
- ✅ Optimistic concurrency control
- ✅ Stream iteration (forward and backward)
- ✅ Batch operations for performance
- ✅ Built-in HTTP caching support
- ✅ PSR-7 and PSR-18 compliant
- ✅ Type-safe with PHP 8.4 features
- ✅ Comprehensive error handling
Architecture
The library follows a clean architecture with a facade pattern that promotes separation of concerns and follows SOLID principles:
Facade Pattern
EventStore acts as a facade that delegates operations to specialized services:
- StreamReader - Handles all stream reading operations
- StreamWriter - Manages stream writing and deletion operations
- StreamIteratorFactory - Creates stream iterators for navigation
Factory Pattern
EventStoreFactory provides the recommended way to instantiate EventStore with proper dependency injection and connection validation:
Benefits
- Testability - Each service can be mocked independently
- Separation of Concerns - Clear boundaries between reading, writing, and iteration
- SOLID Principles - Interface segregation and dependency inversion
- Maintainability - Easier to extend and modify individual components
- Type Safety - Strong typing throughout the service layer
Requirements
- PHP 8.4 or higher
- KurrentDB server (HTTP API enabled)
Installation
Via Composer
Via Metapackage (Recommended)
For the complete package with additional integrations:
Local Development
Quick Start
Basic Setup
Writing Events
Reading Events
Stream Navigation
Optimistic Concurrency Control
Stream Management
Advanced Usage
HTTP Caching
Improve performance with built-in caching:
Custom Service Dependencies
For advanced use cases, you can provide custom implementations of the core services:
Batch Operations
Read multiple events efficiently:
Error Handling
Custom HTTP Client
You can provide your own HTTP client implementing HttpClientInterface:
Development Setup
Quick Start with Make
Testing
The project uses PHPUnit for testing:
API Reference
Main Classes
EventStore- Main facade class for all operationsEventStoreFactory- Factory for creating EventStore instances with proper dependenciesWritableEvent- Represents an event to be writtenWritableEventCollection- Collection of events for atomic writesStreamFeed- Paginated view of a streamEvent- Represents a read event with version and metadata
Service Classes
StreamReader- Handles stream reading operationsStreamWriter- Manages stream writing and deletionStreamIteratorFactory- Creates stream iterators for navigation
Enums
StreamDeletion- SOFT or HARD deletion modesEntryEmbedMode- NONE, RICH, or BODY embed modesLinkRelation- FIRST, LAST, NEXT, PREVIOUS, etc.
Interfaces
EventStoreInterface- Main service interfaceHttpClientInterface- HTTP client abstractionWritableToStream- Objects that can be written to streams
Docker Environment
The project includes a complete Docker setup with:
- KurrentDB (latest) with projections enabled and health checks
- PHP container with all required extensions and dependencies
- Persistent volumes for KurrentDB data and logs
- Automatic service dependency management
The KurrentDB instance is configured with:
- HTTP API on port 2113
- Default credentials:
admin:changeit - All projections enabled
- AtomPub over HTTP enabled
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Before submitting:
Dependency Validation
The project includes dependency validation using composer-require-checker to ensure all used dependencies are properly declared in composer.json:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This project is not endorsed by Event Store LLP nor Kurrent Inc.
Support
All versions of eventstore-client with dependencies
friendsofouro/http-batch-contract Version ^3.0
friendsofouro/http-batch-implementation Version ^3.0
psr/http-client Version ^1.0
psr/http-client-implementation Version *
psr/http-factory Version ^1.1
psr/http-factory-implementation Version *
psr/http-message Version ^2.0
psr/http-message-implementation Version *
ramsey/uuid Version ^4.9
symfony/property-access Version ^7.3 || ^8.0
symfony/serializer Version ^7.3 || ^8.0