PHP code example of loro-dev / loro-php

1. Go to this page and download the library: Download loro-dev/loro-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

loro-dev / loro-php example snippets




oro\LoroDoc;

$doc = new LoroDoc();
$text = $doc->getText('text');

$text->insert(0, 'Hello, Loro');
$doc->commit();

echo $text->slice(0, $text->lenUnicode());
bash
composer 
bash
composer config allow-plugins.huanghantao/loro-php true
composer 
bash
export LORO_PHP_LIBRARY=/absolute/path/to/libloro_php.dylib
bash
php -d ffi.enable=1 example.php
bash
composer install
./scripts/build_php_ffi.sh
LORO_PHP_LIBRARY="$(pwd)/rust/target/release/libloro_php.dylib" composer test
composer cs-fix