PHPackages                             thesis/schema-registry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. thesis/schema-registry

ActiveLibrary[API Development](/categories/api)

thesis/schema-registry
======================

Complete PHP client for Confluent Schema Registry API.

0.1.x-dev(1mo ago)00MITPHPPHP ^8.4CI passing

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/thesis-php/schema-registry)[ Packagist](https://packagist.org/packages/thesis/schema-registry)[ Fund](https://www.tinkoff.ru/cf/5MqZQas2dk7)[ RSS](/packages/thesis-schema-registry/feed)WikiDiscussions 0.1.x Synced 3w ago

READMEChangelogDependencies (14)Versions (1)Used By (0)

Thesis Schema Registry
======================

[](#thesis-schema-registry)

A PHP client for [Confluent Schema Registry](https://docs.confluent.io/platform/current/schema-registry/index.html) with full coverage of the REST API. Format-agnostic by design: works with Avro, JSON Schema, and Protobuf schemas alike.

Why
---

[](#why)

Schema Registry stores versioned schemas and enforces compatibility rules between them. It's the central piece behind Kafka pipelines that need to evolve message formats without breaking producers or consumers. This library is the HTTP client for that registry — it does not parse Avro or any other format itself, it just speaks the REST protocol.

Installation
------------

[](#installation)

```
composer require thesis/schema-registry
```

HTTP transport
--------------

[](#http-transport)

The client is built on PSR-18, so any compliant HTTP client works. For non-blocking I/O — especially when running alongside [thesis/kafka](https://github.com/thesis-php/kafka) — the recommended driver is [`amphp/http-client-psr7`](https://github.com/amphp/http-client-psr7), which adapts the Fiber-based amphp HTTP client to PSR-18.

```
composer require amphp/http-client-psr7 guzzlehttp/psr7
```

`guzzlehttp/psr7` is used here only as a PSR-7 message factory; any PSR-7 implementation will do.

Creating a client
-----------------

[](#creating-a-client)

```
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\Psr7\PsrAdapter;
use Amp\Http\Client\Psr7\PsrHttpClient;
use GuzzleHttp\Psr7\HttpFactory;
use Thesis\SchemaRegistry;

$psrHttpFactory = new HttpFactory();

$client = new SchemaRegistry\Client(
    http: new PsrHttpClient(
        HttpClientBuilder::buildDefault(),
        new PsrAdapter($psrHttpFactory, $psrHttpFactory),
    ),
    requestFactory: $psrHttpFactory,
    streamFactory: $psrHttpFactory,
    config: new SchemaRegistry\Config(
        uri: new SchemaRegistry\URI('http://schema-registry:8081'),
    ),
);
```

Configuration
-------------

[](#configuration)

The `Config` object accepts the registry URI plus optional user agent, authentication, and a default set of `Parameters` applied to every request:

```
use Thesis\SchemaRegistry;
use Thesis\SchemaRegistry\Authentication;
use Thesis\SchemaRegistry\Parameter;

$config = new SchemaRegistry\Config(
    uri: new SchemaRegistry\URI('http://schema-registry:8081'),
    userAgent: 'my-service/1.0',
    authentication: new Authentication\Basic('key', 'secret'),
    parameters: SchemaRegistry\Parameters::of(
        new Parameter\InContext('production'),
    ),
);
```

Using the client
----------------

[](#using-the-client)

All methods on `Client` are typed wrappers over individual REST endpoints. Most calls accept an optional variadic `Parameter ...$parameters` to tweak per-call behaviour (filters, normalization, context overrides, etc.) — see PHPDoc on each method for the list of applicable parameters.

### Registering and fetching schemas

[](#registering-and-fetching-schemas)

```
use Thesis\SchemaRegistry;

$id = $client->registerSchema(
    subject: 'orders-value',
    schema: new SchemaRegistry\Schema('{"type":"record",...}', SchemaRegistry\SchemaType::Avro),
);

$schema = $client->schemaByVersion('orders-value', SchemaRegistry\Version::latest());
$text = $client->schemaTextByVersion('orders-value', SchemaRegistry\Version::latest());
$all = $client->schemas('orders-value'); // every version, ordered
```

Registering the same schema string under the same subject returns the existing id — there's no need to deduplicate on the caller side.

### Listing

[](#listing)

```
$subjects = $client->subjects();
$versions = $client->subjectVersions('orders-value');
$allSchemas = $client->allSchemas();
$supported = $client->supportedTypes(); // [Avro, Protobuf, JSON]
```

### Lookup by id

[](#lookup-by-id)

A schema id is global across the registry. To find where it's used:

```
$subjects = $client->subjectsById($id)
$versions = $client->schemaVersionsById($id);
$schemas = $client->schemaUsages($id);
```

### Lookup by schema content

[](#lookup-by-schema-content)

`lookupSchema` checks whether a schema is already registered under a subject without creating a new version:

```
$existing = $client->lookupSchema('orders-value', $schema);
```

### Compatibility

[](#compatibility)

```
use Thesis\SchemaRegistry;

$result = $client->checkCompatibility('orders-value', $newSchema);
if (!$result->isCompatible) {
    // ...
}

$global = $client->compatibility();
$subjectLevel = $client->compatibility('orders-value');

$client->setCompatibility(new SchemaRegistry\Compatibility(new SchemaRegistry\CompatibilityLevel::Backward), 'orders-value');
$client->resetCompatibility('orders-value');
```

### Deletion

[](#deletion)

By default, deletes are soft — the schema disappears from regular listings but remains in storage. Pass `Parameter\Permanent` for a hard delete (a version must be soft-deleted first):

```
use Thesis\SchemaRegistry\Parameter;

$client->deleteSubject('orders-value');
$client->deleteSubject('orders-value', new Parameter\Permanent(true));

$client->deleteSchema('orders-value', 1);
```

### References

[](#references)

Schemas can reference each other. To discover what depends on a given version:

```
use Thesis\SchemaRegistry;

$dependents = $client->schemaReferences('common-types', SchemaRegistry\Version::latest());
```

Contexts
--------

[](#contexts)

Schema Registry supports multiple isolated namespaces called contexts. Set one as the default on the config:

```
use Thesis\SchemaRegistry;
use Thesis\SchemaRegistry\Parameter;

$config = new SchemaRegistry\Config(
    uri: new SchemaRegistry\URI('http://schema-registry:8081'),
    parameters: SchemaRegistry\Parameters::of(
        new Parameter\InContext('production'),
    ),
);
```

Or override per call:

```
$client->registerSchema(
    'orders-value',
    $schema,
    parameters: [new Parameter\InContext('staging')],
);
```

The per-call value replaces the default for that request; without an override, requests go to the configured context (or the global namespace if none is set).

Authentication
--------------

[](#authentication)

Several authentication schemes are supported. Construct the appropriate `Authentication` and pass it to `Config`:

```
use Thesis\SchemaRegistry\Authentication;
// Basic — also used for Confluent Cloud (API key as username, secret as password)
new Authentication\Basic('key', 'secret');

// Bearer token (OAuth 2.0)
new Authentication\Bearer($token);

// mTLS is configured on the HTTP client itself, not on the registry client
```

Low-level access
----------------

[](#low-level-access)

If an endpoint isn't covered by a typed method, drop down to `Client::call()`:

```
$result = $client->call(new MyCustomRequest(), new Parameter\Normalize());
```

This is the same primitive every high-level method is built on.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance89

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552865?v=4)[Valentin Udaltsov](/maintainers/vudaltsov)[@vudaltsov](https://github.com/vudaltsov)

---

Top Contributors

[![kafkiansky](https://avatars.githubusercontent.com/u/37590388?v=4)](https://github.com/kafkiansky "kafkiansky (11 commits)")

### Embed Badge

![Health badge](/badges/thesis-schema-registry/health.svg)

```
[![Health](https://phpackages.com/badges/thesis-schema-registry/health.svg)](https://phpackages.com/packages/thesis-schema-registry)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36789.4k2](/packages/telnyx-telnyx-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60316.0M89](/packages/mollie-mollie-api-php)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
