PHP code example of packvium / native-bridge

1. Go to this page and download the library: Download packvium/native-bridge 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/ */

    

packvium / native-bridge example snippets




use Packvium\Native\NativePacker;

$packer = new NativePacker('/opt/packvium/libpackvium_ffi.so');
$result = $packer->pack($request);

echo $packer->backend(), PHP_EOL; // "rust" or "php"
echo $result['status'], PHP_EOL;

$packer = new NativePacker();   // no library path: pure PHP, deterministic either way
echo $packer->backend(), PHP_EOL; // "php"
bash
php examples/basic.php                            # pure PHP
php examples/basic.php /path/to/libpackvium.so    # compiled engine