packvium / native-bridge
Optional FFI backend for Packvium with pure-PHP fallback
Requires
- php: >=7.4
Requires (Dev)
- packvium/packvium: ^0.1.0
Suggests
- ext-ffi: Loads the Rust shared library
- packvium/packvium: Provides the pure-PHP 0.1.x fallback
This package is auto-updated.
Last update: 2026-08-14 23:22:33 UTC
README
Optional native backend for Packvium. It uses a Rust shared library through PHP FFI when one is available, and otherwise uses the pure-PHP Packvium package.
Install
composer require packvium/native-bridge packvium/packvium
PHP 7.4 or later is required. Enable ext-ffi and provide a compatible shared library
only when you want the native backend; neither is required for the PHP fallback.
Quick start
<?php 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;
Pass the same request format used by packvium/packvium. If the extension, library or
health check is unavailable, NativePacker selects the PHP backend instead of failing
the packing request.
When to use it
Use this package when your deployment already manages the shared library and you want
the native engine. For a zero-configuration installation, use packvium/packvium
directly.
License
MIT. See LICENSE.