Download the PHP package utopia-php/replication without Composer

On this page you can find all versions of the php package utopia-php/replication. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package replication

Utopia Replication

[!IMPORTANT] This repository is a read-only mirror of the utopia-php monorepo. Development happens in packages/replication — please open issues and pull requests there.

Build Status Total Downloads Discord

Utopia Replication is a Swoole-native MySQL binlog reader. It streams row-level changes (change data capture) from a MySQL server over the replication protocol, so a consumer can react to writes — invalidate caches, build projections, fan out events — by tailing a server locally instead of relying on application-level messaging. This library is maintained by the Appwrite team.

Although this library is part of the Utopia Framework project it is dependency free and can be used as standalone with any other PHP project or framework.

Getting started

Install using Composer:

System requirements

Utopia Replication requires PHP 8.3 or later, and the Swoole extension (>=6.0) for coroutine socket I/O. The OpenSSL extension is required for caching_sha2_password full authentication and TLS.

Source server

The MySQL source must be configured for GTID-based row replication:

binlog_row_metadata = FULL lets column names ride along in the binlog. When it is MINIMAL (the MySQL default, and what some managed providers are fixed to) the reader resolves names from INFORMATION_SCHEMA over a second connection instead — no configuration change required.

The connecting user needs the REPLICATION SLAVE and REPLICATION CLIENT privileges.

Usage

The reader runs inside a Swoole coroutine; getChanges() blocks (yielding the coroutine) while waiting for events. The GTID checkpoint advances on transaction commit, so a crash mid-transaction re-streams it — treat changes as idempotent.

Reading from a binlog file

Decoding and transport are separate: a Decoder turns raw binlog events into Changes, and a Transport supplies those events. The MySQL source above is a live MySQL\Connection transport wired to a Decoder; swap in a MySQL\File transport to decode an archived binlog file — the same bytes mysqlbinlog --raw writes, or a segment pulled from object storage — with no server and no replication privileges:

Scope

Deliberately minimal: MySQL 8, ROW-format binlog, and the event types needed for CDC (TABLE_MAP, WRITE/UPDATE/DELETE_ROWS, GTID, ROTATE, XID). JSON column values are skipped (bytes advanced, not decoded). Column names come from FULL row metadata when available, otherwise from a single cached INFORMATION_SCHEMA lookup per table.

Tests

Copyright and license

The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php


All versions of replication with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-swoole Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package utopia-php/replication contains the following files

Loading the files please wait ...