Event Sourcing & KurrentDB PHP Libraries
Open source PHP libraries for event sourcing
Open source PHP libraries for event sourcing and KurrentDB (formerly EventStoreDB) integration. Our mission is to provide modern, type-safe, and well-tested PHP tools for building event-driven applications.
The main PHP client library for KurrentDB HTTP API
composer require friendsofouro/kurrentdb-core
Convenience package with good defaults
This metapackage includes kurrentdb-core
with sensible default dependencies, perfect for quick setup.
composer require friendsofouro/kurrentdb-php
Symfony 7.3+ integration bundle
Seamless integration of KurrentDB into your Symfony applications with dependency injection, configuration management, and more.
composer require friendsofouro/kurrentdb-bundle
Simple Docker setup for local development
Ready-to-use Docker Compose configuration for running KurrentDB locally. Perfect for development and testing.
docker-compose up
PSR-18 interface contracts for batch HTTP requests
Defines the standard interfaces for handling multiple HTTP requests efficiently. Used internally by KurrentDB libraries for optimized batch operations.
composer require friendsofouro/http-batch-contract
Guzzle implementation for efficient batch HTTP processing
High-performance Guzzle-based implementation of the HTTP batch contracts with caching support and concurrent request handling.
composer require friendsofouro/http-batch-guzzle
use KurrentDB\EventStore;
use FriendsOfOuro\Http\Batch\Guzzle\GuzzleHttpClient;
use KurrentDB\WritableEvent;
use KurrentDB\ValueObjects\Identity\UUID;
use GuzzleHttp\Psr7\HttpFactory;
// Create client
$httpFactory = new HttpFactory();
$httpClient = new GuzzleHttpClient();
$eventStore = new EventStore(
$httpFactory->createUri('http://admin:changeit@127.0.0.1:2113'),
$httpFactory, // UriFactory
$httpFactory, // RequestFactory
$httpClient
);
// Write events
$event = new WritableEvent(
new UUID(),
'user-registered',
['userId' => '123', 'email' => 'user@example.com']
);
$version = $eventStore->writeToStream('user-123', $event);
// Read events
foreach ($eventStore->forwardStreamFeedIterator('user-123') as $entry) {
echo "Event: " . $entry->getEvent()->getType() . "\n";
}
We welcome contributions! Each repository has its own contributing guidelines:
Feel free to open issues, submit pull requests, or discuss improvements in our GitHub repositories.