loro-dev/loro-php
Composer 安装命令:
composer require loro-dev/loro-php
包简介
PHP bindings for Loro CRDT via UniFFI.
README 文档
README
PHP bindings for Loro, built with UniFFI and PHP FFI.
Requirements
- PHP 8.1+
ext-ffiffi.enable=1
Install
composer require huanghantao/loro-php
Composer will ask whether huanghantao/loro-php may run as a plugin. Allow it
to download the native library for your platform.
For CI:
composer config allow-plugins.huanghantao/loro-php true
composer require huanghantao/loro-php
To use your own native library instead:
export LORO_PHP_LIBRARY=/absolute/path/to/libloro_php.dylib
Usage
<?php require __DIR__ . '/vendor/autoload.php'; use Loro\LoroDoc; $doc = new LoroDoc(); $text = $doc->getText('text'); $text->insert(0, 'Hello, Loro'); $doc->commit(); echo $text->slice(0, $text->lenUnicode());
Run PHP with FFI enabled:
php -d ffi.enable=1 example.php
Development
composer install ./scripts/build_php_ffi.sh LORO_PHP_LIBRARY="$(pwd)/rust/target/release/libloro_php.dylib" composer test composer cs-fix
Release
Tag a release and push it. The GitHub workflow builds native libraries and
uploads loro-php-native-<platform>.tar.gz plus checksum files.
git tag -a v0.1.0 -m "Release v0.1.0"
git push origin v0.1.0
Set LORO_PHP_SKIP_NATIVE_INSTALL=1 to skip native download, or
LORO_PHP_NATIVE_RELEASE=<tag> to force a native artifact tag.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-13